protected override void OnRabbitHit(HeroRabbit rabbit) { Destroy(this.gameObject); rabbit.Die(); Orc.rabbitDeathTimeOut = 2f; Orc.rabbitDead = true; }
// 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(); } }
protected override void OnRabitHit(HeroRabbit rabit) { if (rabit.IsBig) { rabit.IsBig = false; } else { rabit.Die(); } this.CollectedHide(); }
void OnTriggerEnter2D(Collider2D collider) { if (this.isActiveAndEnabled) { HeroRabbit rabbit = collider.GetComponent <HeroRabbit>(); if (rabbit != null) { rabbit.Die(); Destroy(this.gameObject); } } }
protected override void OnRabbitHit(HeroRabbit rabbit) { if (rabbit.GetIsBig()) { rabbit.ChangeSize(); } else { rabbit.Die(); } this.CollectedHide(); }
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; } }
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(); } } }
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; } }