private void OnTriggerEnter(Collider other) { player_info player = other.GetComponent <player_info>(); if (player != null) { player.Hurt(damage); } Destroy(this.gameObject); }
//private void OnTriggerStay(Collider other) //{ // //if (other.GetComponent<player_info>() && Time.time >= nexttimetofire && _paintball == null) // //{ // // nexttimetofire = Time.time + 5f / firerate; // // _paintball = Instantiate(paintballprefab) as GameObject; // // _paintball.transform.position = transform.TransformPoint(Vector3.forward * 1.1f); // // _paintball.transform.rotation = transform.rotation; // //} // //if (other.GetComponent<player_info>()) // //{ // // if (_paintball == null) // // { // // _paintball = Instantiate(paintballprefab) as GameObject; // // _paintball.transform.position = transform.TransformPoint(Vector3.forward * 1.1f); // // _paintball.transform.rotation = transform.rotation; // // } // //} //} public void Attack() { // Reset the timer. timer = 0f; play.Hurt(damage); }