Exemple #1
0
    IEnumerator Attack()
    {
        bool Dead = EnemyCharUnit.Damage(PlayerCharUnit.DamageOutput);

        Instantiate(EnemyCharUnit.DamagePart);
        infoText.text = "Dealt Slashing Damage!!!";

        yield return(new WaitForSeconds(1f));

        enemyHUD.PlayerHP(EnemyCharUnit.CurrentHealth);

        if (Dead)
        {
            CurrentState = BattleStateMachine.PlayerWin;
            BattleOver();
        }
        else
        {
            CurrentState = BattleStateMachine.EnemyTurn;
            StartCoroutine(EnemyNoTurn());
        }
    }
Exemple #2
0
    IEnumerator EnemyNoTurn()
    {
        infoText.text = EnemyCharUnit.UnitName + " lunges and deals some physical damage!!";
        yield return(new WaitForSeconds(2f));

        bool PlayerDead = PlayerCharUnit.Damage(EnemyCharUnit.DamageOutput);

        playerHUD.PlayerHP(PlayerCharUnit.CurrentHealth);
        Instantiate(PlayerCharUnit.DamagePart);
        yield return(new WaitForSeconds(2f));

        if (PlayerDead)
        {
            CurrentState = BattleStateMachine.PlayerLose;
            BattleOver();
        }
        else
        {
            CurrentState = BattleStateMachine.PlayerTurn;
            PlayerNoTurn();
        }
    }