Ejemplo n.º 1
0
        public void Update(GameTime gameTime, Tunnel tunnel, Scene scene, Player player)
        {
            foreach (T obj in _usedObjects.ToList())
            {
                if (obj.World.Translation.Z < CLEANING_DISTANCE)
                {
                    RecycleElement(obj);
                    scene.Remove(obj);
                }
                else
                {
                    obj.World = obj.World * Matrix.CreateTranslation(0.0f, 0.0f, -tunnel.DeltaPhase(gameTime));

                    if (obj.World.Translation.Z < COLLISION_CHECKING_DISTANCE)
                    {
                        obj.Entity.CollisionInformation.UpdateBoundingBox(0);
                        player.Entity.CollisionInformation.UpdateBoundingBox(0);
                        HandleCollisions(obj, player, scene);
                    }
                }
            }
        }