示例#1
0
    IEnumerator ActuallyAttack(Unit.ActualAttackData data)
    {
        dialogueText.gameObject.SetActive(true);
        buttonsGameObject.SetActive(false);

        dialogueText.text = data.attackDialogue;

        yield return(new WaitForSeconds(3.5f));

        string dialogue = "You did " + data.damageValue + " damage";

        dialogueText.text = dialogue;
        effects.clip      = damageClip;

        effects.Play();
        bool isDead = currentEnemy.TakeDamage(data.damageValue);

        enemyHUD.UpdateHUD();
        hurtEffectEnemy.Play();

        yield return(new WaitForSeconds(2f));

        if (isDead)
        {
            // End the battle.
            state = BattleState.WON;
            EndBattle();
        }
        else
        {
            state = BattleState.ENEMYTURN;
            EnemyTurn();
        }
    }
示例#2
0
    void NextTurn()
    {
        turn++;
        GUI.SetInfo("Turn #" + turn);
        if (afterEffects != null)
        {
            afterEffects();
        }
        player.stats.ResetAC();
        HUD.UpdateHUD();
        IsDead();

        if (whoFirst)
        {
            state = BattleState.PLAYERTURN;
        }
        else
        {
            state = BattleState.ENEMYTURN;
            StartCoroutine(EnemyTurn());
        }
    }
示例#3
0
    IEnumerator ActualEnemyTurn()
    {
        // stop particle systems from playing.
        foreach (ParticleSystem system in particleSystems)
        {
            system.Stop();
        }

        dialogueText.gameObject.SetActive(true);

        dialogueText.text = "It's " + currentEnemy.unitName + "'s turn";

        yield return(new WaitForSeconds(2f));

        Unit.ActualAttackData data = currentEnemy.FetchAttackDataForEnemy();

        dialogueText.text = data.attackDialogue;

        yield return(new WaitForSeconds(3.5f));

        if (data.isHealer)
        {
            dialogueText.text = currentEnemy.unitName + " healed itself with " + data.damageValue;
        }
        else
        {
            dialogueText.text = currentEnemy.unitName + " did " + data.damageValue + " damage";
        }
        effects.clip = damageClip;

        effects.Play();

        bool isDead = player.TakeDamage(data.damageValue, data.isHealer);

        hurtEffectPlayer.Play();

        playerHUD.UpdateHUD();

        yield return(new WaitForSeconds(3f));

        if (isDead)
        {
            state = BattleState.LOST;
            EndBattle();
        }
        else
        {
            state = BattleState.PLAYERTURN;
            PlayerTurn();
        }
    }
示例#4
0
 private void UpdateHUDS()
 {
     playerHUD.UpdateHUD(playerUnit);
     enemyHUD.UpdateHUD(enemyUnit);
 }