예제 #1
0
    public void TakeDamage(float damage, Vector3 impactValue)
    {
        lifeText.text = currentHealth.ToString("0");
        if (Time.time - lastDamageTime > 1f)
        {
            currentHealth -= damage;
            lifeText.text  = currentHealth.ToString("0");
            gameManager.ComboBreak();
            if (currentHealth > 0)
            {
                m_animatorWrapper.TakeDamageTrigger();
            }
            externalForce += impactValue;
            //effects
            gameManager.StopTime(0.05f, 10, 0.1f);
            StartCoroutine(gameManager.CamShake(0.2f));
            lastDamageTime = Time.time;
            if (currentHealth <= 0)
            {
                moveSpeedStored = moveSpeed;
                moveSpeed       = 0;
                m_animatorWrapper.DeathTrigger();
                myCollider.enabled = false;
                isDead             = true;
                currentHealth      = 0;
                lifeText.text      = currentHealth.ToString("0");

                StartCoroutine(waitToCallContinue());

                //die
            }
        }
    }
예제 #2
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)
         {
             //die
             Dead();
             if (bulletAttack != null)
             {
                 aimingTime      = aimingTimeOriginal;
                 alreadyAttacked = false;
                 StopCoroutine(bulletAttack);
             }
         }
     }
 }
예제 #3
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
            }
        }
    }