コード例 #1
0
        /// <summary>
        /// Sets position of the arrow
        /// </summary>
        /// <param name="attackChoiceArrowPosition"></param>
        public void SetPosition(AttackChoiceArrowPosition attackChoiceArrowPosition)
        {
            AttackChoiceArrowPosition = attackChoiceArrowPosition;

            switch (attackChoiceArrowPosition)
            {
                case AttackChoiceArrowPosition.Move1:
                    Position = new Vector2(10, 120);
                    break;
                case AttackChoiceArrowPosition.Move2:
                    Position = new Vector2(80, 120);
                    break;
                case AttackChoiceArrowPosition.Move3:
                    Position = new Vector2(10, 135);
                    break;
                case AttackChoiceArrowPosition.Move4:
                    Position = new Vector2(80, 135);
                    break;
            }
        }
コード例 #2
0
ファイル: Battle.cs プロジェクト: redomex/LevertPokemon
        public void ChoosingAttack(GameTime gameTime)
        {
            _textPanel.BattleText.FirstLine = "";
            _textPanel.BattleText.SecondLine = "";

            _attackMenu.SetPokemon(ActiveAlliedPokemon.PokemonInstance);
            _attackMenu.Visible = true;
            _attackChoiceArrow.Visible = true;

            if (InputHandler.ActionKeyPressed(ActionKey.Back, PlayerIndex.One))
            {
                // Return to action menu
                CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction;
                _attackMenu.Visible = false;
                _attackChoiceArrow.Visible = false;
            }
            else if (InputHandler.ActionKeyPressed(ActionKey.ConfirmAndInteract, PlayerIndex.One))
            {
                bool validMoveChosen = false;

                switch (_attackChoiceArrow.AttackChoiceArrowPosition)
                {
                    case AttackChoiceArrowPosition.Move1:
                        if (ActiveAlliedPokemon.PokemonInstance.Moves[0].RemainingPP > 0)
                        {
                            PlayerChosenAttack = AttackChoiceArrowPosition.Move1;
                            validMoveChosen = true;
                        }
                        break;
                    case AttackChoiceArrowPosition.Move2:
                        if (ActiveAlliedPokemon.PokemonInstance.Moves[1].RemainingPP > 0)
                        {
                            PlayerChosenAttack = AttackChoiceArrowPosition.Move2;
                            validMoveChosen = true;
                        }
                        break;
                    case AttackChoiceArrowPosition.Move3:
                        if (ActiveAlliedPokemon.PokemonInstance.Moves[2].RemainingPP > 0)
                        {
                            PlayerChosenAttack = AttackChoiceArrowPosition.Move3;
                            validMoveChosen = true;
                        }
                        break;
                    case AttackChoiceArrowPosition.Move4:
                        if (ActiveAlliedPokemon.PokemonInstance.Moves[3].RemainingPP > 0)
                        {
                            PlayerChosenAttack = AttackChoiceArrowPosition.Move4;
                            validMoveChosen = true;
                        }
                        break;
                }

                if (validMoveChosen)
                {
                    CurrentPhase = BattlePhase.EnemyTurn;
                    CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction;
                    PreviousPlayerAttack = PlayerChosenAttack;

                    _attackMenu.Visible = false;
                    _attackChoiceArrow.Visible = false;
                }
            }
        }