//collision method protected override void OnCollisionEnter2D(Collision2D collision) { base.OnCollisionEnter2D(collision); if (collision.gameObject.tag == "Enemy") { BEnemy enemy = collision.gameObject.GetComponent <BEnemy>(); enemy.health -= damage; GameObject.Find("Sound Manager").GetComponent <SoundManager>().PlayOneShot("Arrow_Hit"); Rigidbody2D enemyRigidbody = collision.gameObject.GetComponent <Rigidbody2D>(); enemyRigidbody.transform.Translate((transform.position - source.transform.position).normalized * .2f, Space.World); if (collision.gameObject.name == "Boss") { var eventObj = new Events.ComeToMeEvent(source.transform.position); eventObj.addListener(collision.gameObject); Events.EventManager.Instance.addEvent(eventObj, 0f); } } else if (collision != null) { GameObject.Find("Sound Manager").GetComponent <SoundManager>().PlayOneShot("Arrow_Hit_Obstacle"); } }
public override void handleEvent(ComeToMeEvent eventObj) { if (!(enemy.mainGoal.getFrontMostSubgoal() is HandleComeToMe)) { enemy.mainGoal.forwardGoal(new HandleComeToMe(enemy, eventObj)); } }
public virtual void handleEvent(ComeToMeEvent eventObj) { throw new NotImplementedException(); }