Exemple #1
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.collider.tag == "Ground")
        {
            ps.isGrounded = true;
            playerAnimator.SetBool("isJumping", false);
        }

        if (collision.collider.tag == "Enemy")
        {
            playerAnimator.SetTrigger("isHurt");
            ps.getHit(10.0f);
            gui.ChangeLife(ps.getHp());
        }
    }
Exemple #2
0
    private void ataca(float obj)
    {
        if (timerAttack > TimerCDAttack)
        {
            myAnimator.SetBool("isWalking", false);
            timerAttack = 0;

            //ANIMACIÓN DE ATAQUE setTrigger
            myAnimator.SetTrigger("isAttacking");
            // Debug.Log("Soy " + gameObject.name + " y he desactivado el walking y he hecho un ataque");
            if (obj == -1)
            {
                BurbujaStats b = burbuja.transform.GetComponent <BurbujaStats>();
                b.dañoRecibido();
            }
            else
            {
                playerStats targetStats = target.GetComponent <playerStats>();
                targetStats.getHit(1f);
            }
        }
        myAnimator.SetBool("isWalking", true);
    }