Пример #1
0
    IEnumerator attack(int damage, GameObject enemy)
    {
        if (enemy)
        {
            isDead = enemy.GetComponent <monStats>().damage(damage);
        }

        if (isDead && enemy)
        {
            playerExp.winBattle(enemy.GetComponent <monStats>().expVal);
            Debug.Log("killed");
            Destroy(enemy);
            yield return(new WaitForSeconds(2));

            battleCam.gameObject.SetActive(false);
            regularCam.gameObject.SetActive(true);
            player.inBattle = false;
            battleUI.SetActive(false);
            yield break;
        }

        playerTurn = false;
        yield return(new WaitForSeconds(2));

        enemyTurn = true;
        yield return(new WaitForSeconds(2));

        enemyTurn    = false;
        moveSelected = false;
        playerTurn   = true;
    }