예제 #1
0
        private void SimulateWorld(float frameTime, IEnumerable <IEntity> entities)
        {
            // simulation can introduce deleted entities into the query results
            foreach (var entity in entities)
            {
                if (entity.Deleted)
                {
                    continue;
                }

                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }

                HandleMovement(_mapManager, _tileDefinitionManager, entity, frameTime);
            }

            foreach (var entity in entities)
            {
                if (entity.Deleted)
                {
                    continue;
                }

                DoMovement(entity, frameTime);
            }
        }
예제 #2
0
 public override void Update(float frameTime)
 {
     foreach (var entity in RelevantEntities)
     {
         if (_pauseManager.IsEntityPaused(entity))
         {
             continue;
         }
         entity.GetComponent <BatteryStorageComponent>().Update(frameTime);
     }
 }
        public override void Update(float frameTime)
        {
            foreach (var comp in ComponentManager.EntityQuery <BatteryDischargerComponent>())
            {
                if (_pauseManager.IsEntityPaused(comp.Owner))
                {
                    continue;
                }

                comp.Update(frameTime);
            }
        }
        public override void Update(float frameTime)
        {
            foreach (var(moverComponent, collidableComponent) in EntityManager.ComponentManager.EntityQuery <IMoverComponent, ICollidableComponent>())
            {
                var entity = moverComponent.Owner;
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }

                UpdateKinematics(entity.Transform, moverComponent, collidableComponent);
            }
        }
예제 #5
0
        /// <inheritdoc />
        public override void Update(float frameTime)
        {
            var entities = EntityManager.GetEntities(EntityQuery);

            foreach (var entity in entities)
            {
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }
                DoMovement(entity, frameTime);
            }
        }
예제 #6
0
        /// <inheritdoc />
        public override void Update(float frameTime)
        {
            foreach (var entity in RelevantEntities)
            {
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }
                var mover   = entity.GetComponent <IMoverComponent>();
                var physics = entity.GetComponent <PhysicsComponent>();

                UpdateKinematics(entity.Transform, mover, physics);
            }
        }
예제 #7
0
        private void SimulateWorld(float frameTime, IEnumerable <IEntity> entities)
        {
            foreach (var entity in entities)
            {
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }

                HandleMovement(_mapManager, _tileDefinitionManager, entity, frameTime);
            }

            foreach (var entity in entities)
            {
                DoMovement(entity, frameTime);
            }
        }
예제 #8
0
        /// <inheritdoc />
        public override void Update(float frameTime)
        {
            var entities = EntityManager.GetEntities(EntityQuery);

            _physicsManager.BuildCollisionGrid();
            foreach (var entity in entities)
            {
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }
                HandleMovement(entity, frameTime);
            }
            foreach (var entity in entities)
            {
                DoMovement(entity, frameTime);
            }
        }
예제 #9
0
        public override void Update(float frameTime)
        {
            var uniqueApcNets = new HashSet <IApcNet>(); //could be improved by maintaining set instead of getting collection every frame

            foreach (var entity in RelevantEntities)
            {
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }
                var apc = entity.GetComponent <ApcComponent>();
                uniqueApcNets.Add(apc.Net);
                entity.GetComponent <ApcComponent>().Update();
            }
            foreach (var apcNet in uniqueApcNets)
            {
                apcNet.Update(frameTime);
            }
        }
예제 #10
0
        public override void Update(float frameTime)
        {
            var uniqueApcNets = new HashSet <IApcNet>(); //could be improved by maintaining set instead of getting collection every frame

            foreach (var apc in ComponentManager.EntityQuery <ApcComponent>())
            {
                if (_pauseManager.IsEntityPaused(apc.Owner))
                {
                    continue;
                }

                uniqueApcNets.Add(apc.Net);
                apc.Update();
            }

            foreach (var apcNet in uniqueApcNets)
            {
                apcNet.Update(frameTime);
            }
        }
예제 #11
0
        public override void Update(float frameTime)
        {
            foreach (var entity in RelevantEntities)
            {
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }

                var mover   = entity.GetComponent <IMoverComponent>();
                var physics = entity.GetComponent <IPhysicsComponent>();
                if (entity.TryGetComponent <ICollidableComponent>(out var collider))
                {
                    UpdateKinematics(entity.Transform, mover, physics, collider);
                }
                else
                {
                    UpdateKinematics(entity.Transform, mover, physics);
                }
            }
        }
        public override void Update(float frameTime)
        {
            var entities = EntityManager.GetEntities(EntityQuery);

            foreach (var entity in entities)
            {
                if (_pauseManager.IsEntityPaused(entity))
                {
                    continue;
                }

                var aiComp = entity.GetComponent <AiControllerComponent>();
                if (aiComp.Processor == null)
                {
                    aiComp.Processor              = CreateProcessor(aiComp.LogicName);
                    aiComp.Processor.SelfEntity   = entity;
                    aiComp.Processor.VisionRadius = aiComp.VisionRadius;
                }

                var processor = aiComp.Processor;

                processor.Update(frameTime);
            }
        }
예제 #13
0
 /// <inheritdoc />
 public override void Update(float frameTime)
 {
     SimulateWorld(frameTime,
                   RelevantEntities.Where(e => !e.Deleted && !_pauseManager.IsEntityPaused(e))
                   .Select(p => p.GetComponent <ICollidableComponent>()).ToList());
 }
예제 #14
0
 /// <inheritdoc />
 public override void Update(float frameTime)
 {
     SimulateWorld(frameTime, RelevantEntities.Where(e => !e.Deleted && !_pauseManager.IsEntityPaused(e)).ToList());
 }