Update() 공개 메소드

public Update ( ) : void
리턴 void
예제 #1
0
        public void Update(GameTime gt)
        {
            float dt = (float)gt.ElapsedGameTime.TotalSeconds;

            // Update the physics multiple times per frame (in this case, 10 times per frame)
            for (int i = 0; i < _physicsSubstep; i++)
            {
                PhysicsManager.Update(dt / _physicsSubstep);
            }

            AIManager.Update(this, dt);

            // Check if there are less enemies than the maximum and add more as necessary
            if (Enemies.Count < MaximumEnemies)
            {
                SpawnEnemy();
            }

            // Update the spawn points
            foreach (SpawnPoint sp in SpawnPoints)
            {
                if (sp.TimeSinceLastSpawn > sp.RespawnDelay && !ActiveSpawnPoints.Contains(sp))
                {
                    ActiveSpawnPoints.Add(sp);
                }

                sp.TimeSinceLastSpawn += dt;
            }

            // Health shouldn't be below 0
            if (PortalHealth < 0)
            {
                PortalHealth = 0;
            }

            // If you haven't lost yet, keep updating the score
            if (!GameOver)
            {
                Score += dt;
            }
        }
예제 #2
0
        protected override void Update(GameTime gameTime)
        {
            float secondsElapsed = gameTime.ElapsedGameTime.Milliseconds / 1000.0f;

            lobby.Update();
            serverLogic.Update(this, lobby);
            aiManager.Update(secondsElapsed);

            base.Update(gameTime);

            this.GameObjectCollection.ServerUpdate(lobby, gameTime);

            //TODO: probably remove this
            List <BigShip> list = this.GameObjectCollection.GetMasterList().GetList <BigShip>();

            if (list.Count != 0)
            {
                this.Camera.Update(list[0], secondsElapsed);
            }
            //
        }