コード例 #1
0
        private void UpdatePlayingState(GameTime gameTime)
        {
            Utility.tdGameTimer += gameTime.ElapsedGameTime;

            difficultyCooldown.Update(gameTime);
            if (difficultyCooldown.IsExpired)
            {
                difficultyCooldown.Reset();
                Utility.GameDifficulty++;
            }

            Utility.board.Update(gameTime);
            HoveringOverTowerChecker();
            TowerMovementChecker();
            TowerHotkeyHandler();
            TowerSwitchInput();
            sidebarUI.Update(gameTime);
            input.Update();
            if (input.MouseRightButtonPressed && IsWithinDimensions())
            {
                if (Utility.MaxTowers > Utility.TowerList.Count)
                {
                    AddTower(input.MouseToGameGrid().X, input.MouseToGameGrid().Y, Utility.TowerType.FlameThrower, Utility.TowerList.Count + 1);
                }
            }
            for (int i = Utility.TowerList.Count - 1; i >= 0; i--)
            {
                Tile currenttile = Utility.board.GetTile(new Point(Utility.TowerList[i].X, Utility.TowerList[i].Y));
                if (Utility.board.IsTileOnPath(currenttile))
                {
                    Utility.TowerList[i].IsDisabled = true;
                }
                else
                {
                    Utility.TowerList[i].IsDisabled = false;
                }
                Utility.TowerList[i].Update(gameTime);
            }

            /*
             * if (input.MouseLeftButtonPressed)
             * {
             *  if (Utility.board.Paths.Count > 0)
             *  {
             *      Minion m = new Minion(0, 0, Utility.MinionType.fast);
             *      Utility.board.Paths[0].AddMinion(m);
             *  }
             * }
             */
        }