Пример #1
0
    IEnumerator PlayerRepairFrontWheelHP()
    {
        playerCarUnit.RepairFrontWheelHP(2);

        playerHUD.SetFrontWheelHP(playerCarUnit);

        DisablePlayerActions();
        DisablePlayerRepairActions();

        yield return(new WaitForSeconds(1f));

        state = BattleState.ENEMYTURN;
        StartCoroutine(EnemyTurn());
    }
Пример #2
0
    IEnumerator PlayerAttackFrontWheelHP()
    {
        bool isFrontWheelDead = enemyCarUnit.TakeDamageFrontWheelHP(playerCarUnit.mainWeaponDamage);

        enemyHUD.SetFrontWheelHP(enemyCarUnit);

        Instantiate(littleExplosion, enemyInitialPosition);

        DisablePlayerActions();
        DisablePlayerAttackActions();

        yield return(new WaitForSeconds(1f));

        if (isFrontWheelDead)
        {
            StartCoroutine(WheelDestroyed());
            attackFrontWheelHP.gameObject.SetActive(false);

            if (enemyCarUnit.ReturnCarCurrentHP(enemyCarUnit.carCurrentHP))
            {
                state = BattleState.WON;
                winScreen.SetActive(true);
            }
            else
            {
                state = BattleState.ENEMYTURN;
                StartCoroutine(EnemyTurn());
            }
        }
        else
        {
            state = BattleState.ENEMYTURN;
            StartCoroutine(EnemyTurn());
        }
    }