Пример #1
0
 void OnEnable()
 {
     playerLevel    = gameObject.GetComponent <PlayerLevel>();
     energyBar      = GameObject.FindGameObjectWithTag("Energy");
     energyBarTrans = energyBar.GetComponent <RectTransform>();
     level          = playerLevel.getLevel();
 }
Пример #2
0
 public void levelUpHealth()
 {
     level              = playerLevel.getLevel();
     maxHealth          = Mathf.Pow(level / constant, 2f);
     healthBar.maxValue = maxHealth;
     currentHealth      = maxHealth;
     healthBar.value    = currentHealth;
 }
Пример #3
0
 public void levelUpHunger()
 {
     level              = playerLevel.getLevel();
     maxHunger          = Mathf.Pow(level / constant, 2f);
     hungerBar.maxValue = maxHunger;
     currentHunger      = maxHunger;
     hungerBar.value    = currentHunger;
 }
Пример #4
0
 void OnEnable()
 {
     playerLevel    = gameObject.GetComponent <PlayerLevel>();
     playerEnergy   = gameObject.GetComponent <PlayerEnergy>();
     healthBar      = GameObject.FindGameObjectWithTag("Health");
     healthBarTrans = healthBar.GetComponent <RectTransform>();
     level          = playerLevel.getLevel();
     player         = GameObject.FindGameObjectWithTag("Player");
     sprite         = player.GetComponent <SpriteRenderer>();
     canvas         = GameObject.FindGameObjectWithTag("Canvas");
 }
Пример #5
0
    void Awake()
    {
        currentHealth   = 25f;
        healthBar.value = currentHealth;

        playerLevel = player.GetComponent <PlayerLevel>();
        level       = playerLevel.getLevel();

        maxHealth          = 25f;
        healthBar.maxValue = maxHealth;

        regenRate = 5f;
        timer     = 0f;
    }
Пример #6
0
    void Awake()
    {
        currentHunger      = 25f;
        hungerBar.value    = currentHunger;
        maxHunger          = 25f;
        hungerBar.maxValue = maxHunger;

        degenRate = .5f;
        timer     = 0f;

        playerHealth = player.GetComponent <PlayerHealth>();
        playerLevel  = player.GetComponent <PlayerLevel>();
        level        = playerLevel.getLevel();
    }
Пример #7
0
 /* -------------------- GUI update ------------------------- */
 void guiUpdate()       // update the ui
 {
     energyGUI.text = "ENERGY: " + playerEnergy.getEnergyPercent().ToString("F0") + "%";
     scoreGUI.text  = "SCORE: " + playerScore.getScore().ToString();
     lvlGUI.text    = "LEVEL: " + playerLevel.getLevel().ToString();
 }
Пример #8
0
 public void levelUpHealth()
 {
     level         = playerLevel.getLevel();
     maxHealth     = Mathf.Pow(level / constant, 2f);
     currentHealth = maxHealth;
 }
Пример #9
0
 public void levelUpEnergy()
 {
     level         = playerLevel.getLevel();
     maxEnergy     = Mathf.Pow(level / constant, 2f);
     currentEnergy = maxEnergy;
 }