Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (health <= 0)
        {
            loseUI.SetActive(true);
            Time.timeScale = 0.0f;
        }

        if (input.potionInput)
        {
            if (potionNumber > 0)
            {
                RestoreHealth(potionRestoreValue);
                partCont.SpawnHealingParticle(this.transform.position);
                potionNumber--;
            }
        }
        potionNumberUI.text = potionNumber.ToString();
        coinUI.text         = coins.ToString();

        if (stamina >= 100)
        {
            stamina = 100;
        }
        if (stamina < 0)
        {
            stamina = 0;
        }
        else
        {
            stamina += staminaRate * Time.deltaTime;
        }

        isInvulnerable();

        if (matColor.color != normalColor)
        {
            matColor.color = Color.Lerp(matColor.color, normalColor, 1 * Time.deltaTime);
        }
    }