Beispiel #1
0
    protected virtual IEnumerator attack(float animationTime)
    {
        //Anim.SetTrigger("attack");

        Aud.PlayOneShot(audioAttack);
        yield return(new WaitForSeconds(animationTime / 2));

        //Desplega el damageBox
        damageBox.localPosition = new Vector3(0, 0, 0);
        damageBox.localScale    = Vector3.one;


        yield return(new WaitForSeconds(animationTime / 2));

        //reset damagebox
        damageBox.localScale = Vector3.zero;
    }
Beispiel #2
0
    protected override IEnumerator attack(float animationTime)
    {
        isAttacking = true;
        Anim.SetTrigger("attack");

        yield return(new WaitForSeconds(animationTime / 2));

        //Desplega el damageBox
        Aud.PlayOneShot(audioAttack);
        damageBox.localPosition = Vector3.zero;
        damageBox.localScale    = Vector3.one;


        yield return(new WaitForSeconds(animationTime / 2));

        //reset damagebox
        damageBox.localScale = Vector3.zero;

        isAttacking = false;
    }
Beispiel #3
0
    protected virtual void GetHurt(int inDamageValue)
    {
        if (!invulnerable)
        {
            Health -= (inDamageValue - defense);
            if (Health > 0)
            {
                //Anim.SetTrigger("Hurt");
                Aud.PlayOneShot(audioDamage);
            }
            else
            {
                //Anim.SetTrigger("Die");
                Aud.PlayOneShot(audioDeath);
                Destroy(gameObject, audioDeath.length);
            }

            invulnerable = true;
            StartCoroutine(ModifierCountDown(1, (x) => invulnerable = x));
        }
    }
 protected virtual void GetHurt(int inDamageValue)
 {
     if (!invulnerable)
     {
         Health -= (inDamageValue - defense);
         if (Health > 0)
         {
             Aud.PlayOneShot(audioDamage);
             Anim.SetTrigger("damage");
         }
         else
         {
             Aud.PlayOneShot(audioDeath);
             Anim.SetTrigger("death");
         }
         invulnerable = true;
         if (Health > 0)
         {
             StartCoroutine(ModifierCountDown(1, (x) => invulnerable = x));
         }
     }
 }
 protected override void GetHurt(int inDamageValue)
 {
     if (!invulnerable)
     {
         Health -= (inDamageValue - defense);
         if (Health > 0)
         {
             Aud.PlayOneShot(audioDamage);
             Anim.SetTrigger("damage");
         }
         else
         {
             Aud.PlayOneShot(audioDeath);
             EnemyState = botStates.dying;
             Anim.SetTrigger("death");
             gameManager.instance.StartCoroutine(DespawnNWait(RespawnTime));
         }
         invulnerable = true;
         if (Health > 0)
         {
             StartCoroutine(ModifierCountDown(1, (x) => invulnerable = x));
         }
     }
 }