public IEnumerator RunLevelup(StatsContainer stats)
    {
        yield return(new WaitForSeconds(2f));

        levelupCongrats.SetActive(false);
        levelupStats.SetActive(true);

        yield return(new WaitForSeconds(1.5f));

        _level++;
        stats.level++;
        stats.currentSp += 4;
        levelLevel.SetActive(true);
        stats.CalculateStats();
        yield return(new WaitForSeconds(0.2f));

        if (stats.hp > _hp)
        {
            _hp++;
            levelHp.SetActive(true);
            yield return(new WaitForSeconds(0.2f));
        }
        if (stats.atk > _atk)
        {
            _atk++;
            levelAtk.SetActive(true);
            yield return(new WaitForSeconds(0.2f));
        }
        if (stats.spd > _spd)
        {
            _spd++;
            levelSpd.SetActive(true);
            yield return(new WaitForSeconds(0.2f));
        }
        if (stats.def > _def)
        {
            _def++;
            levelDef.SetActive(true);
            yield return(new WaitForSeconds(0.2f));
        }
        if (stats.res > _res)
        {
            _res++;
            levelRes.SetActive(true);
            yield return(new WaitForSeconds(0.2f));
        }
        if (stats.currentSp > _sp)
        {
            int diff = stats.currentSp - _sp;
            _sp             = stats.currentSp;
            spGainText.text = "+" + diff;
            levelSp.SetActive(true);
            yield return(new WaitForSeconds(0.2f));
        }

        yield return(new WaitForSeconds(1f));
    }
예제 #2
0
 private void Start()
 {
     SetupLists();
     if (stats == null || stats.level == -1)
     {
         currentHealth = 0;
         gameObject.SetActive(false);
         Debug.Log("No stats");
         return;
     }
     stats.ReadCharValues();
     stats.boosts.Clear();
     ActivateSkills(Activation.PASSIVE, null);
     stats.CalculateStats();
     gameObject.name = stats.charName;
     currentHealth   = stats.hp;
     GetComponent <SpriteRenderer>().sprite = stats.battleSprite;
     currentTile = mapCreator.GetTile(posx, posy);
     currentTile.currentCharacter = this;
     transform.position           = new Vector3(currentTile.transform.position.x, currentTile.transform.position.y, 0);
 }
예제 #3
0
    /// <summary>
    /// Sets up the character with default stats and resets values.
    /// </summary>
    public void Setup()
    {
        if (stats == null || stats.level == -1)
        {
            currentHealth = 0;
            gameObject.SetActive(false);
            Debug.LogWarning("No stats");
            return;
        }
        currentHealth = stats.hp;
        stats.boosts.Clear();
        ActivateSkills(SkillActivation.PASSIVE, null);
        stats.CalculateStats();
        gameObject.name = stats.charData.entryName;
        currentHealth   = stats.hp;
        UpdateHealth();
        inventory.CleanupInventory();
        currentTile = battleMap.GetTile(posx, posy);
        currentTile.currentCharacter = this;
        transform.position           = new Vector3(currentTile.transform.position.x, currentTile.transform.position.y, 0);

        gameObject.SetActive(true);
        ExtraSetup();
    }