void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Bee")) { if (stingerState == 4) { print("aaaaa"); StartCoroutine("ShowingCanvas"); print("Bee shooted"); //other.gameObject.SetActive (false); beeScript = other.gameObject.GetComponent <tutorialBeeBehavior>(); beeScript.shooted = true; beeScript.hitSound(); Rigidbody rb = other.GetComponent <Rigidbody> (); Vector3 movement = shootingDestination - transform.position; rb.AddForce(movement * 300.0f); } } if (other.gameObject.CompareTag("Stinger")) { print("Stinger collide"); StingerBehavior stingerScript = other.GetComponent <StingerBehavior> (); stingerScript.stingerState = 5; } }
void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Bee")) { if (stingerState == 4) { print("Bee shooted"); //other.gameObject.SetActive (false); beeScript = other.gameObject.GetComponent <BeeBehavior1>(); beeScript.shooted = true; beeScript.hitSound(); Rigidbody rb = other.GetComponent <Rigidbody> (); Vector3 movement = shootingDestination - transform.position; rb.AddForce(movement * 300.0f); } } if (other.gameObject.CompareTag("Stinger")) { print("Stinger collide"); StingerBehavior stingerScript = other.GetComponent <StingerBehavior> (); stingerScript.stingerState = 5; healthscript.increaseEnergy(20.0f); } }