Пример #1
0
    //For when the torch takes damage
    public void takeDamage(int damage, bool crit, GameObject source)
    {
        if (isDamagable)
        {
//		Debug.Log (gameObject + " takes " + damage + " damage.");
            health -= damage;
            DamagePopUp.CreateTorchHealthPopUp(damage, ui, true);
            updateHealth();
            TorchFOV.SetTrigger("TakeDamage");

            if (health <= 0)
            {
                health = 0;
                updateHealth();

                string sourceString = source.name;
                if (sourceString.EndsWith("(Clone)"))
                {
                    sourceString = sourceString.Remove(sourceString.Length - 7);
                }
                Debug.Log("Player dies by taking " + damage + " from " + sourceString);
                gameManager.deathCanvas.SetCauseText("by taking " + damage + " damage from " + sourceString + ".");

                Die();
            }
        }
    }
Пример #2
0
    //For when the player e.g. picks up a healthPickUp.
    public void heal(int healingAmount)
    {
//		Debug.Log (gameObject + " heals " + healingAmount + "points");
        health += healingAmount;
        if (health > startingHealth)
        {
            health = startingHealth;
        }
        DamagePopUp.CreateTorchHealthPopUp(healingAmount, ui, false);
        updateHealth();
        StartCoroutine(ParticlesCoroutine());
    }