示例#1
0
    public void takeDamage(float dps)
    {
        if (alive)
        {
            script_hit.PlayHitSound();
            actualHealth -= dps;

            temp              = damageImage.color;
            temp.a            = 1 - (actualHealth / maxHealth);
            damageImage.color = temp;

            recoverTimer = recoverDelay;
        }
        if (actualHealth <= 0 && Alive)
        {
            Alive = false;
            if (froze)
            {
                anim.speed = 1f;
                goAttachedToModel.GetComponent <Renderer>().material.SetColor("_Color", normalColor);
            }
            anim.SetTrigger("dead");
            onTriggerDead.Invoke();
            StartCoroutine(Respawn());
        }
    }
示例#2
0
    public void takeDamage(float dps)
    {
        actualHealth -= dps;

        if (actualHealth <= 0 && alive)
        {
            alive = false;
            //anim.SetTrigger("dead");
            onTriggerDead.Invoke();
            Destroy(gameObject);
        }
    }
示例#3
0
    //******************************************************************
    //Prise de dégats de l'enclos
    //******************************************************************
    public void DamageEnclos(int degats)
    {
        health -= degats;
        if (health <= 0)
        {
            health = 0; //santé min
            //Debug.LogError("Enclos Mort");
            onTriggerDead.Invoke();
            onTriggerDead = null; //On reset le delegate
        }
        int diffSheep = (nbSheep + 1) - Mathf.RoundToInt(health / 10.0f);

        for (int i = 0; i < diffSheep; i++)
        {
            KillSheep();
        }
    }