A stable modding interface between Techblox and mods https://mod.exmods.org/
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
624B

  1. using RobocraftX.DOTS;
  2. using TechbloxModdingAPI.Utility;
  3. using Unity.Entities;
  4. using Unity.Transforms;
  5. namespace TechbloxModdingAPI.Common.Traits;
  6. public interface IHasPhysics
  7. {
  8. }
  9. public static class HasPhysicsExtensions
  10. {
  11. internal static void UpdatePhysicsUECSComponent<T, O>(this O obj, T componentData) where O : EcsObjectBase, IHasPhysics where T : struct, IComponentData
  12. {
  13. var phyStruct = obj.GetComponentOptional<DOTSPhysicsEntityStruct>();
  14. if (phyStruct) //It exists
  15. FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.Get().dotsEntity, componentData);
  16. }
  17. }