Exemplo n.º 1
0
    public void TakeDamage(float damage, Vector3 ImpactValue)
    {
        if (Time.time - lastDamageTime > 0.15f)
        {
            Debug.Log("tomei dnao");
            currentHealth -= damage;
            if (currentHealth > 0)
            {
                m_animator.SetTrigger("takeDamage");
            }
            externalForce += ImpactValue;
            gameManager.StopTime(0.25f, 10, 0f);
            StartCoroutine(gameManager.CamShake(0.05f));
            lastDamageTime = Time.time;
            if (currentHealth <= 0)
            {
                dead = true;
                m_collider.enabled = false;
                m_animator.SetTrigger("death");

                gameManager.AddScore();
                gameManager.RespawnEnemy(this);
                //die
            }
        }
    }
Exemplo n.º 2
0
 void Dead()
 {
     eStates            = EnemyStates.Dead;
     m_collider.enabled = false;
     m_animator.SetTrigger("death");
     gameManager.AddScore();
     gameManager.RespawnEnemy(this);
 }