Пример #1
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld(worldName);

            _filter = world.Filter <T> ().End();
            _pool   = world.GetPool <T> ();
        }
Пример #2
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            boundingCircles = world.Filter <BoundingCircle>().End();
            meshes          = world.Filter <Mesh>().Inc <Pose>().End();
        }
Пример #3
0
        public void Init(EcsSystems systems)
        {
            var worldConstraints = systems.GetWorld(PhysicsWorldNames.Constraints);

            springsBodyBody  = worldConstraints.Filter <SpringBodyBody>().End();
            springsBodySpace = worldConstraints.Filter <SpringBodySpace>().End();
        }
Пример #4
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            circles = world.Filter <RigidBody>().Inc <Circle>().Inc <BoundingBox>().End();
            meshes  = world.Filter <RigidBody>().Inc <Mesh>().Inc <BoundingBox>().End();
            grabberElasticityCoefficient = 40f;
        }
Пример #5
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            shapes        = world.Filter <Shape>().Inc <BoundingBox>().End();
            shapesPool    = world.GetPool <Shape>();
            boundingBoxes = world.GetPool <BoundingBox>();
        }
Пример #6
0
        public void Init(EcsSystems systems)
        {
            var worldEvents = systems.GetWorld(PhysicsWorldNames.Events);
            var physicsData = systems.GetShared <PhysicsData>();

            contacts     = worldEvents.Filter <Contact <TagA, TagB> >().End();
            contactsPool = worldEvents.GetPool <Contact <TagA, TagB> >();
            RegisterSolver(worldEvents, physicsData.ContactSolversMatrix);
        }
Пример #7
0
        public void Init(EcsSystems systems)
        {
            var worldEvents = systems.GetWorld(PhysicsWorldNames.Events);
            var physicsData = systems.GetShared <PhysicsData>();

            possibleContacts     = worldEvents.Filter <PossibleContact <ShapeA, ShapeB> >().End();
            possibleContactsPool = worldEvents.GetPool <PossibleContact <ShapeA, ShapeB> >();
            contactSolversMatrix = physicsData.ContactSolversMatrix;
            RegisterTester(worldEvents, physicsData.ContactTestersMatrix);
        }
Пример #8
0
        public void Run(EcsSystems systems)
        {
            var world        = systems.GetWorld();
            var entities     = world.Filter <UIPosition>().Inc <UIText>().End();
            var positionPool = world.GetPool <UIPosition>();
            var textPool     = world.GetPool <UIText>();

            foreach (var entity in entities)
            {
                ref UIPosition pos  = ref positionPool.Get(entity);
                ref UIText     text = ref textPool.Get(entity);
Пример #9
0
 static bool InjectWorld(FieldInfo fieldInfo, IEcsSystem system, EcsSystems systems)
 {
     if (fieldInfo.FieldType == WorldType)
     {
         if (Attribute.IsDefined(fieldInfo, WorldAttrType))
         {
             var worldAttr = (EcsWorldAttribute)Attribute.GetCustomAttribute(fieldInfo, WorldAttrType);
             fieldInfo.SetValue(system, systems.GetWorld(worldAttr.World));
         }
         return(true);
     }
     return(false);
 }
Пример #10
0
        public void Run(EcsSystems systems)
        {
            var worldConstraints = systems.GetWorld(PhysicsWorldNames.Constraints);
            var sharedData       = systems.GetShared <SharedData>();
            var factory          = sharedData.ObjectsFactory;
            var keys             = sharedData.Keys;

            var mousePositionWorld = keys.GetMousePosition() * sharedData.RenderData.PixelsToMeters;

            if (isActive && keys[MouseButtons.Left])
            {
                ref var spring = ref springsBodySpace.Get(springEntity);
                spring.AttachmentPointSpace = mousePositionWorld;
            }
Пример #11
0
 static bool InjectPool(FieldInfo fieldInfo, IEcsSystem system, EcsSystems systems)
 {
     if (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == PoolType)
     {
         if (Attribute.IsDefined(fieldInfo, PoolAttrType))
         {
             var poolAttr       = (EcsPoolAttribute)Attribute.GetCustomAttribute(fieldInfo, PoolAttrType);
             var world          = systems.GetWorld(poolAttr.World);
             var componentTypes = fieldInfo.FieldType.GetGenericArguments();
             fieldInfo.SetValue(system, GetGenericGetPoolMethod(componentTypes[0]).Invoke(world, null));
         }
         return(true);
     }
     return(false);
 }
Пример #12
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            segments = world.Filter <Segment>().End();
        }
Пример #13
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            bodies = world.Filter <RigidBody>().Inc <Pose>().Inc <Velocity>().End();
        }
Пример #14
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            bodies = world.Filter <BodyMask>().Inc <BoundingBox>().End();
        }
Пример #15
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            aaboxes = world.Filter <AABox>().Inc <BoundingBox>().End();
        }