Example #1
0
    /// <summary>
    /// A helper function for <see cref="updateExp"/>  that performs an exp increase within a single level interval.
    /// Updates text display if player levels up
    /// </summary>
    /// <returns>Coroutines to update exp display and add a delay before scene closes</returns>
    /// <param name="gainedExp">Exp gained within this level interval</param>
    /// <param name="levelledUp">If set to <c>true</c> indicates the player is about to level up.</param>
    private IEnumerator updateExpHelper(int gainedExp, bool levelledUp)
    {
        yield return(StartCoroutine(expBar.updateDisplay(player.Exp, player.Exp + gainedExp)));

        player.gainExp(gainedExp);
        if (levelledUp)
        {
            textBox.text = player.Name + " grew to level " + player.Level + "!";
            SoundManager.instance.playSFX("interact");
        }
        yield return(new WaitForSeconds(1.5f));
    }
Example #2
0
 private IEnumerator updateBars(CharacterMove move, int previousHealth, int previousMagic)
 {
     if (move.User is Player)
     {
         StartCoroutine(playerMagicBar.updateDisplay(previousMagic, move.User.Magic));
     }
     else             //if user is Enemy
     {
         StartCoroutine(enemyMagicBar.updateDisplay(previousMagic, move.User.Magic));
     }
     if (move.Target is Player)
     {
         yield return(playerHealthBar.updateDisplay(previousHealth, move.Target.Health));
     }
     else             //if target is Enemy
     {
         yield return(enemyHealthBar.updateDisplay(previousHealth, move.Target.Health));
     }
 }