示例#1
0
    public void OnClick_PartyMember(int partyMemberIndex)
    {
        Monster selectedMonster = playerParty.Monsters[partyMemberIndex];

        if (selectedMonster.CurrentHealth <= 0)
        {
            partyScreen.SetMessageText("This monster is currently unable to battle.");
            return;
        }
        else if (selectedMonster == playerUnit.Monster)
        {
            partyScreen.SetMessageText("This monster is already in battle.");
            return;
        }

        partyScreen.gameObject.SetActive(false);

        if (previousState == BattleState.ActionSelection)
        {
            StartCoroutine(RunTurns(BattleAction.SwitchMonster, selectedMonster));
        }
        else
        {
            ChangeState(BattleState.Busy);
            battleDialogueBox.SetDialogue("");
            StartCoroutine(SwitchMonster(selectedMonster));
        }
    }
    private void HandlePartySelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentPartyMember_Index;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentPartyMember_Index;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentPartyMember_Index += 2;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentPartyMember_Index -= 2;
        }

        currentPartyMember_Index = Mathf.Clamp(currentPartyMember_Index, 0, playerParty.PokemonTeam.Count - 1);

        _partyScreen.UpdatePartyMemberSelection(currentPartyMember_Index);

        if (Input.GetKeyDown(KeyCode.Z))
        {
            dialogBox.EnableMoveSelector(false);
            dialogBox.EnableDialogText(true);

            var selectedMember = playerParty.PokemonTeam[currentPartyMember_Index];
            if (selectedMember.HP <= 0)
            {
                _partyScreen.SetMessageText("You can't send out a fainted pokemon");
                return;
            }

            if (selectedMember == playerUnit._Pokemon)
            {
                _partyScreen.SetMessageText("You can't switch with the same pokemon");
                return;
            }
            _partyScreen.gameObject.SetActive(false);
            state = BattleState.Busy;

            if (currentCoroutine == null)
            {
                currentCoroutine = StartCoroutine(SwitchPokemon(selectedMember));
            }
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            _partyScreen.gameObject.SetActive(false);

            if (currentCoroutine == null)
            {
                currentCoroutine = StartCoroutine(ActionSelection_Interaction(true, false));
            }
        }
    }
示例#3
0
    //controls party selector
    void HandlePartySelection()
    {
        Action onSelected = () =>
        {
            var selectedUnit = partyscreen.SelectedUnit;
            if (selectedUnit.HP <= 0)
            {
                partyscreen.SetMessageText("he is no loger with us");
                return;
            }
            if (selectedUnit == playerUnit.Piece)
            {
                partyscreen.SetMessageText("he already in the fight");
                return;
            }

            partyscreen.gameObject.SetActive(false);

            if (partyscreen.CalledFrom == BattleState.ActionSelection)
            {
                // if switch during turn
                StartCoroutine(RunTurns(BattleAction.SwitchPiece));
            }
            else
            {
                //if piece is dead
                state = BattleState.Busy;
                bool isEnemyAboutToUse = partyscreen.CalledFrom == BattleState.AboutToUse;
                StartCoroutine(SwitchUnit(selectedUnit, isEnemyAboutToUse));
            }

            partyscreen.CalledFrom = null;
        };

        Action onBack = () =>
        {
            if (playerUnit.Piece.HP <= 0)
            {
                partyscreen.SetMessageText("piece must be in play");
                return;
            }

            partyscreen.gameObject.SetActive(false);

            if (partyscreen.CalledFrom == BattleState.AboutToUse)
            {
                StartCoroutine(SendNextEnemyPiece());
            }
            else
            {
                ActionSelection();
            }

            partyscreen.CalledFrom = null;
        };

        partyscreen.HandleUpdate(onSelected, onBack);
    }
示例#4
0
    void PartySelectorHandler()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 2;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 2;
        }

        // limit it to 0-(number of teras in party) index
        currentMember = Mathf.Clamp(currentMember, 0, playersParty.Party_List.Count - 1);

        partyScreen.UpdateMemberSelection(currentMember);

        if (Input.GetKeyDown(KeyCode.E))
        {
            var selectedMember = playersParty.Party_List[currentMember];
            if (selectedMember.Health <= 0)
            {
                partyScreen.SetMessageText("Can't send out Fainted Teras!");
                return;
            }
            if (selectedMember == playerUnit.teras)
            {
                partyScreen.SetMessageText("Can't send out same Teras!");
                return;
            }
            partyScreen.gameObject.SetActive(false);

            if (previousState == BattleState.ActionSelection)
            {
                previousState = null;
                StartCoroutine(RunTurns(BattleAction.SwitchTeras));
            }
            else
            {
                state = BattleState.Busy;
                StartCoroutine(SwitchTeras(selectedMember));
            }
        }
        else if (Input.GetKeyDown(KeyCode.R))
        {
            partyScreen.gameObject.SetActive(false);
            PlayerAction();
        }
    }
示例#5
0
    void HandlePartySelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 2;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 2;
        }

        currentMember = Mathf.Clamp(currentMember, 0, playerParty.Pokemons.Count - 1);

        partyScreen.UpdateMemberSelection(currentMember);

        if (Input.GetKeyDown(KeyCode.Z))
        {
            var selectedMember = playerParty.Pokemons[currentMember];
            if (selectedMember.HP <= 0)
            {
                partyScreen.SetMessageText("You can't send out a fainted Fantasy Monster");
                return;
            }
            if (selectedMember == playerUnit.Pokemon)
            {
                partyScreen.SetMessageText("You can't switch with the same Fantasy Monster");
                return;
            }
            partyScreen.gameObject.SetActive(false);

            if (prevState == BattleState.ActionSelection)
            {
                prevState = null;
                StartCoroutine(RunTurns(BattleAction.SwitchPokemon));
            }
            else
            {
                state = BattleState.Busy;
                StartCoroutine(SwitchPokemon(selectedMember));
            }
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            partyScreen.gameObject.SetActive(false);
            ActionSelection();
        }
    }
示例#6
0
    //Permet au joueur de choisir le pokemon qu'il veut avec les flèches dans la selections des pokemon
    void HandlePartySelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentMember;
        }

        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentMember;
        }

        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 2;
        }

        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 2;
        }

        //Fixe l'index entre 0 et -1 grace à la méthode Clamp disponible dans Mathf
        currentMember = Mathf.Clamp(currentMember, 0, playerParty.Pokemons.Count - 1);

        partyScreen.UpdateMemberSelection(currentMember);

        //Vérifie si le pokemon que le joueur n'est pas mort ou si il  n'est pas deja au combat
        if (Input.GetKeyDown(KeyCode.Space))
        {
            var selectedMember = playerParty.Pokemons[currentMember];
            if (selectedMember.HP <= 0)
            {
                partyScreen.SetMessageText("You can't send out a fainted pokemon");
                return;
            }
            if (selectedMember == playerUnit.Pokemon)
            {
                partyScreen.SetMessageText("You can't switch with the same pokemon");
                return;
            }

            //La selection de pokemon est désactivée et la méthode Sxitch est lancée
            partyScreen.gameObject.SetActive(false);
            state = BattleState.Busy;
            StartCoroutine(SwitchPokemon(selectedMember));
        }
        else if (Input.GetKeyDown(KeyCode.R))
        {
            partyScreen.gameObject.SetActive(false);
            PlayerAction();
        }
    }
示例#7
0
    void HandlePartySelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 2;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 2;
        }

        currentMember = Mathf.Clamp(currentMember, 0, servantParty.Servants.Count - 1);

        partyScreen.UpdateMemberSelection(currentMember);

        if (Input.GetKeyDown(KeyCode.Z))
        {
            var selectedMember = servantParty.Servants[currentMember];
            if (selectedMember.HP <= 0)
            {
                partyScreen.SetMessageText("You cannot send out a defeated Servant");
                return;
            }
            if (selectedMember == playerUnit.servantInfo)
            {
                partyScreen.SetMessageText("You cannot switch with the same Servant");
                return;
            }

            partyScreen.gameObject.SetActive(false);
            state = BattleState.Busy;
            StartCoroutine(SwitchServant(selectedMember));
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            partyScreen.gameObject.SetActive(false);
            ActionSelection();
        }
    }
示例#8
0
    //similar as the above 2 functions,
    //but now we also are checking to see if the player has selected a valid pokemon
    void HandlePartySelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 2;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 2;
        }
        currentMember = Mathf.Clamp(currentMember, 0, playerParty.Pokemons.Count - 1); //clamps current action between 0 and 3 (4 moves)

        partyScreen.UpdateMemberSelection(currentMember);

        if (Input.GetKeyDown(KeyCode.Z))
        {
            var selectedMember = playerParty.Pokemons[currentMember];
            if (selectedMember.Hp <= 0)
            {
                partyScreen.SetMessageText("This pokemon has already fainted!");
                return;
            }
            if (selectedMember == playerUnit.pokemon)
            {
                partyScreen.SetMessageText("This pokemon is already out!");
                return;
            }
            partyScreen.gameObject.SetActive(false);
            state = BattleState.Busy;
            StartCoroutine(SwitchPokemon(selectedMember));
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            partyScreen.gameObject.SetActive(false);
            ActionSelection();
        }
    }
示例#9
0
    void HandlePartySelection()
    {
        dialogBox.EnableActionSelector(false);
        if (!pokemonMoveConfirm)
        {
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                ++CurrentPokemon;
            }
            else if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                --CurrentPokemon;
            }
            else if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                CurrentPokemon += 2;
            }
            else if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                CurrentPokemon -= 2;
            }

            CurrentPokemon = Mathf.Clamp(CurrentPokemon, 0, playerParty.Pokemons.Count - 1);

            partyScreen.UpdatePokemonSelection(CurrentPokemon);

            if (Input.GetKeyDown(KeyCode.Z))
            {
                var selectedMember = playerParty.Pokemons[CurrentPokemon];
                if (selectedMember.HP <= 0)
                {
                    partyScreen.SetMessageText("You can't send out a fainted Pokemon!");
                    return;
                }
                else if (selectedMember == playerUnit.Pokemon)
                {
                    partyScreen.SetMessageText($"{playerUnit.Pokemon.Base.Name} is already in battle!");
                    return;
                }
                else
                {
                    SelectedMember = selectedMember;
                    partyScreen.SetConfirmActive(true);

                    pokemonMoveConfirm = true;
                }
            }
            else if (Input.GetKeyDown(KeyCode.X))
            {
                partyScreen.gameObject.SetActive(false);
                ActionSelection();
            }
        }
        else
        {
            partyScreen.SetMessageText($"Are you sure you want to send {SelectedMember.Base.Name} into batte?");

            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                ++CurrentConfirm;
            }
            else if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                --CurrentConfirm;
            }
            else if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                ++CurrentConfirm;
            }
            else if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                --CurrentConfirm;
            }

            CurrentPokemon = Mathf.Clamp(CurrentPokemon, 0, 1);

            partyScreen.PokemonConfirmBox.UpdateActionSelection(CurrentConfirm);

            if (Input.GetKeyDown(KeyCode.Z))
            {
                if (CurrentConfirm == 0)
                {
                    partyScreen.gameObject.SetActive(false);
                    state = BattleState.Busy;
                    pokemonMoveConfirm = false;
                    StartCoroutine(SwitchPokemon(SelectedMember));
                }
                else
                {
                    partyScreen.SetMessageText("Choose a Pokemon.");
                    partyScreen.SetConfirmActive(false);
                    pokemonMoveConfirm = false;
                }
            }
            else if (Input.GetKeyDown(KeyCode.X))
            {
                partyScreen.SetMessageText("Choose a Pokemon.");
                partyScreen.SetConfirmActive(false);
                pokemonMoveConfirm = false;
            }
        }
    }
示例#10
0
    void HandlePartySelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 2;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 2;
        }

        currentMember = Mathf.Clamp(currentMember, 0, playerParty.Animals.Count - 1);

        partyScreen.UpdateMemberSelection(currentMember);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            var selectedMember = playerParty.Animals[currentMember];
            if (selectedMember.HP <= 0)
            {
                partyScreen.SetMessageText($"{selectedMember.Base.Name} is unable to fight!");
                return;
            }
            if (selectedMember == playerUnit.Animal)
            {
                partyScreen.SetMessageText($"{playerUnit.Animal.Base.Name} is already in the fight!");
                return;
            }

            partyScreen.gameObject.SetActive(false);

            if (prevState == BattleState.ActionSelection)
            {
                prevState = null;
                StartCoroutine(RunTurns(BattleAction.SwitchAnimal));
            }
            else
            {
                state = BattleState.Busy;
                StartCoroutine(SwitchAnimal(selectedMember));
            }
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            if (playerUnit.Animal.HP <= 0)
            {
                partyScreen.SetMessageText("You must select an animal to continue the duel!");
                return;
            }

            partyScreen.gameObject.SetActive(false);

            if (prevState == BattleState.AboutToUse)
            {
                prevState = null;
                StartCoroutine(SendNextOutlawAnimal());
            }
            else
            {
                ActionSelection();
            }
        }
    }
示例#11
0
        private void HandlePartySelection()
        {
            if (Keyboard.current.rightArrowKey.wasPressedThisFrame)
            {
                ++_currentMember;
            }
            else if (Keyboard.current.leftArrowKey.wasPressedThisFrame)
            {
                --_currentMember;
            }
            else if (Keyboard.current.downArrowKey.wasPressedThisFrame)
            {
                _currentMember += 3;
            }
            else if (Keyboard.current.upArrowKey.wasPressedThisFrame)
            {
                _currentMember -= 3;
            }

            _currentMember = Mathf.Clamp(_currentMember, 0, _playerParty.Monsters.Count - 1);
            _partyScreen.UpdateMemberSelection(_currentMember);

            if (Keyboard.current.zKey.wasPressedThisFrame)
            {
                MonsterObj selectedMember = _playerParty.Monsters[_currentMember];
                if (selectedMember.CurrentHp <= 0)
                {
                    _partyScreen.SetMessageText("That Battokuri is downed and cannot be used!");
                    return;
                }

                if (selectedMember == _playerMonster.Monster)
                {
                    _partyScreen.SetMessageText("That Battokuri is already being used!");
                    return;
                }

                _partyScreen.gameObject.SetActive(false);
                // If player switched monster voluntarily it should count as a turn move
                // If monster was downed and forced switch then it should trigger a new turn
                if (_prevState == BattleState.ActionSelection)
                {
                    _prevState = null;
                    StartCoroutine(ExecuteTurn(BattleAction.SwitchMonster));
                }
                else
                {
                    _state = BattleState.Busy;
                    StartCoroutine(SwitchMonster(selectedMember));
                }
            }
            else if (Keyboard.current.xKey.wasPressedThisFrame)
            {
                if (_playerMonster.Monster.CurrentHp <= 0)
                {
                    _partyScreen.SetMessageText("You must select a Battokuri!");
                    return;
                }

                _partyScreen.gameObject.SetActive(false);
                if (_prevState == BattleState.ChoiceSelection)
                {
                    _prevState = null;
                    StartCoroutine(SwitchEnemyMonster());
                }
                else
                {
                    ActionSelection();
                }
            }
        }
    /*
     * Se encarga de la gestion de la pantalla de seleccionar otro pokemon para salir a la batalla
     */
    void HandlePartyScreenSelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            currentMember++;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            currentMember--;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 2;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 2;
        }

        //currentMember = Mathf.Clamp(currentMember, 0, playerParty.Pokemons.Count - 1);
        currentMember = Mathf.Clamp(currentMember, 0, player1Team.Pokemons.Count - 1);
        partyScreen.UpdateMemberSelection(currentMember);

        if (Input.GetKeyDown(KeyCode.Z))
        {
            //Sale a combatir el pokemon seleccionado
            //var selectedMember = playerParty.Pokemons[currentMember];
            var selectedMember = player1Team.Pokemons[currentMember];
            if (selectedMember.CurrentHP <= 0)
            {
                partyScreen.SetMessageText("You can´t send out a fainted pokemon");
                return;
            }
            if (selectedMember == playerUnit.Pokemon)
            {
                partyScreen.SetMessageText("You can´t switch with the same pokemon");
                return;
            }

            partyScreen.gameObject.SetActive(false);

            if (prevState == BattleState.ActionSelection) //En este caso cambia porque quiere, de modo que tras el cambio el enemigo atacara
            {
                prevState = null;
                //StartCoroutine(RunTurns(BattleAction.SwitchPokemon));
                player1Slots[currentSlot].battleAction = BattleAction.SwitchPokemon;
            }
            else //En este caso significa que ha muerto el anterior
            {
                //state = BattleState.Busy;wdas
                StartCoroutine(SwitchPokemon(selectedMember));
            }
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            //Vuelve hacia atras (solo si tu pokemon esta vivo)
            if (playerUnit.Pokemon.CurrentHP > 0)
            {
                partyScreen.gameObject.SetActive(false);
                ActionSelection();
            }
        }
    }
示例#13
0
    private void HandlePartySelection()
    {
        if (!_pressedBtn)
        {
            if (Input.GetAxisRaw("Horizontal") > 0)
            {
                if (_currentPartyMemberIndex < _playerParty.NuzlonList.Count - 1)
                {
                    _currentPartyMemberIndex++;
                    _pressedBtn = true;
                }
            }
            else if (Input.GetAxisRaw("Horizontal") < 0)
            {
                if (_currentPartyMemberIndex > 0)
                {
                    _currentPartyMemberIndex--;
                    _pressedBtn = true;
                }
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                if (_currentPartyMemberIndex < _playerParty.NuzlonList.Count - 2)
                {
                    _currentPartyMemberIndex += 2;
                    _pressedBtn = true;
                }
            }
            else if (Input.GetAxisRaw("Vertical") > 0)
            {
                if (_currentPartyMemberIndex > 1)
                {
                    _currentPartyMemberIndex -= 2;
                    _pressedBtn = true;
                }
            }

            _partyScreen.UpdateMemberSelection(_currentPartyMemberIndex);
        }

        if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0)
        {
            _pressedBtn = false;
        }

        if (Input.GetButtonDown("Jump"))
        {
            Nuzlon selectedMember = _playerParty.NuzlonList[_currentPartyMemberIndex];
            if (selectedMember.CurrentHP <= 0)
            {
                _partyScreen.SetMessageText("You can't send out a fainted Nuzlon");
                return;
            }
            if (selectedMember == _playerUnit.BattleNuzlon)
            {
                _partyScreen.SetMessageText("That Nuzlon is already out");
                return;
            }

            //_dialogueBox.EnableMoveSelector(false);
            //_dialogueBox.EnableDialogueText(true);
            _partyScreen.gameObject.SetActive(false);
            state = BattleState.Busy;
            StartCoroutine(SwitchNuzlon(selectedMember));
        }
        else if (Input.GetButtonDown("Fire1"))
        {
            if (_playerUnit.BattleNuzlon.CurrentHP <= 0)
            {
                return;
            }
            _partyScreen.gameObject.SetActive(false);
            ActionSelection();
        }
    }
示例#14
0
    void HandlePartySelection()
    {
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --currentMember;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            currentMember += 3;
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            currentMember -= 3;
        }

        currentMember = Mathf.Clamp(currentMember, 0, playerParty.Pokemons.Count - 1);

        partyScreen.UpdateMemberSelection(currentMember);

        if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space))
        {
            var selectedMember = playerParty.Pokemons[currentMember]; //Creating a var of the actual pokemon we are on
            if (selectedMember.HP <= 0)                               //Making sure the actual pokemon selected ain't fainted
            {
                partyScreen.SetMessageText("Vous ne pouvez pas envoyer un pokemon K.O!");
                return;
            }
            if (selectedMember == playerUnit.Pokemon) //Making sure the actual selected pokemon is not the same as the one in the battle
            {
                partyScreen.SetMessageText("Ce pokemon est déjà au combat.");
                return;
            }

            partyScreen.gameObject.SetActive(false);                   //Changing the actual view on the screen

            if (prevState == BattleState.ActionSelection)              //the player decided to change
            {
                prevState = null;                                      //Reste the prev state before doing anything else
                StartCoroutine(RunTurns(BattleActions.SwitchPokemon)); //Call the coroutine to switch
            }
            else //Here the pokemon fainted, so the player won't lost a turn
            {
                state = BattleState.Busy;                      //State is changed to busy so player won't mess with the UI
                StartCoroutine(SwitchPokemon(selectedMember)); //Calling coroutine to switch pokemons
            }
        }
        else if (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Backspace))
        {
            if (playerUnit.Pokemon.HP <= 0) //Player has to change if the actual pokemon is dead
            {
                partyScreen.SetMessageText("Vous devez choisir un pokemon pour continuer.");
                return;
            }

            partyScreen.gameObject.SetActive(false); //Disable party screen

            if (prevState == BattleState.AboutToUse)
            {
                prevState = null;                         //Change prev state
                StartCoroutine(SendNextTrainerPokemon()); //Continue battle
            }
            else
            {
                ActionSelection();
            }
        }
    }