Update() public method

public Update ( ) : void
return void
Exemplo n.º 1
0
        public void Update()
        {
            if (!init)
            {
                Lists.playerList.Add(new Player.Player(new Vector2(GetCenterX + PlayScreenMinX, 440)));
                playerSpawnFrame = 0;
                init             = true;
            }
            playerSpawnFrame--;
            stage.Update();

            if (playerSpawnFrame == 0)
            {
                Lists.playerList.Add(new Player.Player(new Vector2(GetCenterX + PlayScreenMinX, 440)));
            }
            if (playerSpawnFrame < 0)
            {
                Lists.playerList[0].Update();
                GameStats.UpdatePlayerPosition();
                if (Lists.playerList[0].IsDead())
                {
                    Lists.playerList.Clear();
                    playerSpawnFrame = 60;
                }
            }

            for (int i = Lists.itemList.Count - 1; i >= 0; i--)
            {
                ItemPrime item = Lists.itemList[i];
                item.Update();

                if (!item.GetAlive())
                {
                    Lists.itemList.Remove(item);
                }
            }

            for (int i = Lists.enemyList.Count - 1; i >= 0; i--)
            {
                EnemyPrime enemy = Lists.enemyList[i];
                enemy.Update();

                if (!enemy.GetAlive())
                {
                    Lists.enemyList.Remove(enemy);
                }
            }
            for (int i = 0; i <= Lists.bomb.Count - 1; i++)
            {
                Bomb bomb = Lists.bomb[i];
                bomb.Update();
                if (bomb.GetOver())
                {
                    Lists.bomb.Clear();
                }
            }
            for (int i = Lists.bulletList.Count - 1; i >= 0; i--)
            {
                Bullet bullet = Lists.bulletList[i];
                bullet.Update();

                if (!bullet.IsAlive())
                {
                    Lists.bulletList.Remove(bullet);
                }
            }
            for (int i = Lists.FXList.Count - 1; i >= 0; i--)
            {
                FX fx = Lists.FXList[i];
                fx.Update();

                if (!fx.IsAlive())
                {
                    Lists.FXList.Remove(fx);
                }
            }
            for (int i = 0; i <= Lists.playerBulletList.Count - 1; i++)
            {
                PlayerBulletPrime playerbullet = Lists.playerBulletList[i];
                playerbullet.Update();

                if (!playerbullet.GetAlive())
                {
                    Lists.playerBulletList.Remove(playerbullet);
                }
            }
        }