Ejemplo n.º 1
0
 protected override void OnRabbitHit(HeroRabbit rabbit)
 {
     Destroy(this.gameObject);
     rabbit.Die();
     Orc.rabbitDeathTimeOut = 2f;
     Orc.rabbitDead         = true;
 }
Ejemplo n.º 2
0
    // function will be called when other object will collide into this one
    void OnTriggerEnter2D(Collider2D other)
    {
        // try to get rabbit component
        HeroRabbit rabbit = other.GetComponent <HeroRabbit>();

        // other can be not a rabbit
        if (rabbit != null)
        {
            rabbit.Die();
        }
    }
Ejemplo n.º 3
0
 protected override void OnRabitHit(HeroRabbit rabit)
 {
     if (rabit.IsBig)
     {
         rabit.IsBig = false;
     }
     else
     {
         rabit.Die();
     }
     this.CollectedHide();
 }
Ejemplo n.º 4
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (this.isActiveAndEnabled)
     {
         HeroRabbit rabbit = collider.GetComponent <HeroRabbit>();
         if (rabbit != null)
         {
             rabbit.Die();
             Destroy(this.gameObject);
         }
     }
 }
Ejemplo n.º 5
0
 protected override void OnRabbitHit(HeroRabbit rabbit)
 {
     if (rabbit.GetIsBig())
     {
         rabbit.ChangeSize();
     }
     else
     {
         rabbit.Die();
     }
     this.CollectedHide();
 }
Ejemplo n.º 6
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 > 45f && angle < 135f)
        {
            Die();
        }
        else
        {
            animator.SetTrigger("attack");
            rabbit.Die();

            rabbitDeathTimeOut = 2.1f;
            rabbitDead         = true;
        }
    }
Ejemplo n.º 7
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        HeroRabbit HeroRabbit = collider.GetComponentInParent <HeroRabbit> ();

        if (HeroRabbit != null)
        {
            GameObject rabbit = HeroRabbit.gameObject;
            if (rabbit.transform.position.y > this.transform.position.y + 1)
            {
                this.Die();
                HeroRabbit.myBody.velocity += new Vector2(0, 5);
            }
            else
            {
                this.animator.SetTrigger("attack");
                HeroRabbit.Die();
            }
        }
    }
Ejemplo n.º 8
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)
        {
            Die();
        }
        else
        {
            if (SoundManager.current.isSoundOn())
            {
                attackSource.Play();
            }
            animator.SetTrigger("attack");
            rabbitDead = true;
            rabbit.Die();
            waitForRabbitToDieTime = 1f;
        }
    }