void OnCollisionEnter(Collision collision) { GameObject obj = collision.gameObject; if (obj.tag == "bug" && m_controller.CanPickupBug()) { BugController bug = obj.GetComponent <BugController> (); bug.GetStuck(gameObject); m_bugs.Add(bug); if (bug.IsShootable()) { } else { return; } } else if (obj.tag == "player") { TongueController player = obj.GetComponent <TongueController> (); player.Strike(); Vector3 f = m_controller.GetTongueVelocity(); f.y = 20f; f *= 15.0f; collision.rigidbody.AddForce(f); } m_controller.RetractTongue(); }
protected override void ReachedChaseTarget(GameObject target) { TongueController tc = target.GetComponent <TongueController>(); tc.Strike(); Rigidbody r = target.GetComponent <Rigidbody>(); Vector3 f = transform.forward * 400; r.AddForce(f); }