Update() private method

private Update ( ) : void
return void
Beispiel #1
0
        public void Update(GameTime gameTime)
        {
            if (!fade.IsEnd)
            {
                fade.Update(gameTime);
            }
            if (bossAlert.Initialized)
            {
                bossAlert.Update(gameTime);
            }
            hitStop.Update(gameTime);
            if (hitStop.isHitStop)
            {
                return;
            }
#if DEBUG
            if (Input.GetKeyTrigger(Keys.Enter))
            {
                //シーン移動
                isEndFlag = true;
                next      = Scene.Ending;
            }
#endif

            if (gameObjectManager.Map.CheckAllBlockDead())
            {
                //シーン移動
                isEndFlag = true;
                next      = Scene.GameOver;
            }

            if (!LifeWall.AllIsDead() && !ScrollStop)
            {
                scroll--;
            }
            if (scroll < Screen.Height)
            {
                scroll = Screen.Height;
            }

            if (Menu.GetDifficulty() == Menu.Difficulty.tutorial && !ScrollStop)
            {
                foreach (var height in stopHeights)
                {
                    if (scroll == height)
                    {
                        ScrollStop = true;
                    }
                }
            }
            else if (ScrollStop)
            {
                if (gameObjectManager.Find <Enemy>().FindIndex(enemy => enemy.IsInScreen()) == -1)
                {
                    ScrollStop = false;
                    var blocks = gameObjectManager.Map.GetAllBlockInScreen();
                    foreach (var block in blocks)
                    {
                        if (block.IsSolid)
                        {
                            GameDevice.Instance().GetSound().PlaySE("success");
                            gameObjectManager.Map.ReplaceBlock(block, new Space());
                        }
                    }
                }
            }

            GameDevice.Instance().DisplayModify = new Vector2(0, -scroll + Screen.Height);
            gameObjectManager.Update(gameTime);
            particleManager.Update(gameTime);

            if (gameObjectManager.Find <Boss>().Count == 0)
            {
                isEndFlag = true;
                next      = Scene.Ending;
            }
            if (Menu.GetDifficulty() == Menu.Difficulty.tutorial)
            {
                next = Scene.Title;
            }

            if (scroll == BossAlert.AlertHeight && Menu.GetDifficulty() != Menu.Difficulty.tutorial)
            {
                if (!bossAlert.Initialized)
                {
                    bossAlert.Initialize();
                }
                bossAlert.Update(gameTime);
            }
        }