Ejemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (this.isActiveAndEnabled)
     {
         HeroRabbit rabbit = collider.GetComponent <HeroRabbit>();
         if (rabbit != null)
         {
             rabbit.Kill();
             Destroy(this.gameObject);
         }
     }
 }
Ejemplo n.º 2
0
 public void Respawn(HeroRabbit rabbit)
 {
     rabbit.transform.position = this.startingPosition;
     lives--;
     if (lives == 0)
     {
         rabbit.Kill();
         LosePopUp.Instance.Open();
     }
     if (lives >= 0)
     {
         heartsImages[lives].sprite = noHeart;
     }
 }
Ejemplo n.º 3
0
        public void OnRabbitDeath(HeroRabbit heroRabbit)
        {
            if (heroRabbit.IsGrewUp())
            {
                heroRabbit.GrowDown();
            }
            else
            {
                --_lifesLeft;
                heroRabbit.Kill(LifesCount == -1 || _lifesLeft > 0);
            }

            UpdateContainers();
        }
Ejemplo n.º 4
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();
        }
    }
Ejemplo n.º 5
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();
        }
    }