public void OnCollisionStay(Collision collision) { if ((collision.transform.tag == "Player") && (action == true)) { Target_Player target = collision.transform.GetComponent <Target_Player>(); if (target != null) { target.TakeDamage(damage); target.gameObject.GetComponent <Rigidbody>().AddForce(0, forceApplied, 0); Debug.Log("Hit one"); action = false; } } }
public void OnCollisionStay(Collision collision) { if ((collision.transform.tag == "Player") && (action == true)) { Target_Player target = collision.transform.GetComponent <Target_Player>(); if (target != null) { target.TakeHealth(health); Debug.Log("Healed one"); action = false; Destroy(gameObject); } } }
public void OnCollisionEnter(Collision collision) { if (collision.transform.tag == "Player") { Target_Player target = collision.transform.GetComponent <Target_Player>(); if (target != null) { target.TakeDamage(damage); Debug.Log(damage); Destroy(gameObject); } } Destroy(gameObject); }