Example #1
0
        private IEnumerator SetupBattle()
        {
            //TODO - handle case with no healthy monsters
            _playerMonster.HideHud();
            _enemyMonster.HideHud();
            if (!_isCharBattle)
            {
                _playerMonster.Setup(_playerParty.GetHealthyMonster());
                _enemyMonster.Setup(_wildMonster);
                _dialogBox.SetMoveList(_playerMonster.Monster.Moves);
                yield return(_dialogBox.TypeDialog($"You have encountered an enemy {_enemyMonster.Monster.Base.Name}!"));
            }
            else
            {
                ShowCharacterSprites();
                yield return(_dialogBox.TypeDialog($"{_battler.Name} has challenged you to a battle!"));

                // Deploy enemy monster.
                _battlerImage.gameObject.SetActive(false); //TODO - animate this
                _enemyMonster.gameObject.SetActive(true);
                MonsterObj enemyLeadMonster = _battlerParty.GetHealthyMonster();
                _enemyMonster.Setup(enemyLeadMonster);
                yield return(_dialogBox.TypeDialog($"{_battler.Name} has deployed {enemyLeadMonster.Base.Name} to the battle!"));

                // Deploy player monster.
                _playerImage.gameObject.SetActive(false); //TODO - animate this too
                _playerMonster.gameObject.SetActive(true);
                MonsterObj playerLeadMonster = _playerParty.GetHealthyMonster();
                _playerMonster.Setup(playerLeadMonster);
                _dialogBox.SetMoveList(_playerMonster.Monster.Moves);
                yield return(_dialogBox.TypeDialog($"You have deployed {playerLeadMonster.Base.Name} to the battle!"));
            }

            _escapeAttempts = 0;
            _partyScreen.Init();
            ActionSelection();
        }
Example #2
0
    private IEnumerator SetupBattle()
    {
        battleDialogueBox.SetDialogue("");

        if (!isTamerBattle)
        {
            // Wild Monster Battle
            canFlee = true;

            playerUnit.gameObject.SetActive(true);
            enemyUnit.gameObject.SetActive(true);

            playerImage.gameObject.SetActive(false);
            enemyTamerImage.gameObject.SetActive(false);

            playerUnit.Setup(playerParty.GetHealthyMonster());
            enemyUnit.Setup(wildMonster.Monster);

            Coroutine playerEnterAnimationCor = StartCoroutine(playerUnit.PlayEnterAnimation());
            yield return(enemyUnit.PlayEnterAnimation());

            yield return(playerEnterAnimationCor);

            SetupAttackButtons(playerUnit.Monster.BasicMove, playerUnit.Monster.Moves);
            yield return(battleDialogueBox.TypeDialogue($"A wild { enemyUnit.Monster.MonsterBase.Name } appeared."));
        }
        else
        {
            // Tamer Battle
            canFlee = false;

            playerUnit.gameObject.SetActive(false);
            enemyUnit.gameObject.SetActive(false);
            playerUnit.HUD.gameObject.SetActive(false);
            enemyUnit.HUD.gameObject.SetActive(false);

            playerImage.gameObject.SetActive(true);
            enemyTamerImage.gameObject.SetActive(true);
            playerImage.sprite     = playerController.BattleSprite;
            enemyTamerImage.sprite = enemyTamerController.BattleSprite;

            yield return(battleDialogueBox.TypeDialogue($"{ enemyTamerController.Name } wants to fight."));

            // Send out enemy's first monster
            enemyTamerImage.gameObject.SetActive(false);
            enemyUnit.gameObject.SetActive(true);
            Monster enemyMonster = enemyTamerParty.GetHealthyMonster();
            enemyUnit.Setup(enemyMonster);
            Coroutine enemyEnterAnimationCor = StartCoroutine(enemyUnit.PlayEnterAnimation());
            yield return(battleDialogueBox.TypeDialogue($"{ enemyTamerController.Name } sent out { enemyMonster.MonsterBase.Name }."));

            yield return(enemyEnterAnimationCor);

            // Send out player's first monster
            playerImage.gameObject.SetActive(false);
            playerUnit.gameObject.SetActive(true);
            Monster playerMonster = playerParty.GetHealthyMonster();
            playerUnit.Setup(playerMonster);
            Coroutine playerEnterAnimationCor = StartCoroutine(playerUnit.PlayEnterAnimation());
            yield return(battleDialogueBox.TypeDialogue($"Go { playerMonster.MonsterBase.Name }."));

            yield return(playerEnterAnimationCor);

            SetupAttackButtons(playerMonster.BasicMove, playerMonster.Moves);
        }

        partyScreen.Init();

        ActionSelection();
        SetActionsButtonsInteractable(true);
    }