Esempio n. 1
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld(worldName);

            _filter = world.Filter <T> ().End();
            _pool   = world.GetPool <T> ();
        }
Esempio n. 2
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            boundingCircles = world.Filter <BoundingCircle>().End();
            meshes          = world.Filter <Mesh>().Inc <Pose>().End();
        }
Esempio n. 3
0
        public void Init(EcsSystems systems)
        {
            var worldConstraints = systems.GetWorld(PhysicsWorldNames.Constraints);

            springsBodyBody  = worldConstraints.Filter <SpringBodyBody>().End();
            springsBodySpace = worldConstraints.Filter <SpringBodySpace>().End();
        }
Esempio n. 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;
        }
Esempio n. 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>();
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
Esempio n. 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);
 }
Esempio n. 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;
            }
Esempio n. 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);
 }
Esempio n. 12
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            segments = world.Filter <Segment>().End();
        }
Esempio n. 13
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            bodies = world.Filter <RigidBody>().Inc <Pose>().Inc <Velocity>().End();
        }
Esempio n. 14
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

            bodies = world.Filter <BodyMask>().Inc <BoundingBox>().End();
        }
Esempio n. 15
0
        public void Init(EcsSystems systems)
        {
            var world = systems.GetWorld();

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