Exemplo n.º 1
0
    protected override void OnRabbitHit(HeroRabbit rabbit)
    {
        float myPosY     = transform.position.y;
        float rabbitPosY = HeroRabbit.LastRabbit.transform.position.y;

        if (rabbitPosY - myPosY >= _rabbitWinHeight)
        {
            // rabbit is higher, orc dies and rabbit jumps
            Die();
            rabbit.Jump();
        }
    }
Exemplo n.º 2
0
    void OnRabbitHit(HeroRabbit rabbit)
    {
        Vector3 v     = rabbit.transform.position - transform.position;
        float   angle = Mathf.Atan2(v.y, v.x) / Mathf.PI * 180;

        if (angle > 60f && angle < 150f)
        {
            rabbit.Jump();
            Kill();
        }
        else
        {
            animator.SetTrigger("isAttacking");
            rabbit.Kill();
        }
    }
Exemplo n.º 3
0
    void OnRabbitHit(HeroRabbit rabbit)
    {
        Vector3 v     = rabbit.transform.position - transform.position;
        float   angle = Mathf.Atan2(v.y, v.x) / Mathf.PI * 180;

        if (angle > 60f && angle < 150f)
        {
            rabbit.Jump();
            Kill();
        }
        else
        {
            if (SoundManager.Instance.isSoundOn())
            {
                attackSource.Play();
            }
            animator.SetTrigger("isAttacking");
            rabbit.Kill();
        }
    }