void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "coin" || col.gameObject.tag == "Shield" || col.gameObject.tag == "Protection" || col.gameObject.tag == "wall" || (col.gameObject.tag == "Player" && col.gameObject.GetComponentInParent <PlayerControllerOnline>().isLocalPlayer == false)) { if (col.gameObject.tag == "Player" && col.gameObject.GetComponentInParent <PlayerControllerOnline> ().isLocalPlayer == false) { myplayer = col.gameObject.GetComponentInParent <PlayerControllerOnline> (); float nMonedas = Mathf.Ceil(myplayer.getMonedas() / 2); myplayer.attack(nMonedas, 10.0f); } Destroy(energyBall); // Explosion instatiation GameObject explosion_handler_tmp; explosion_handler_tmp = Instantiate(explosion, col.transform.position, col.transform.rotation) as GameObject; ParticleSystem ps_tmp; ps_tmp = explosion_handler_tmp.GetComponent <ParticleSystem>(); ps_tmp.Play(); Destroy(explosion_handler_tmp, 2.0f); } }
// Use this for initialization void Start() { textolargo.text = "0"; myplayer = this.gameObject.GetComponentInParent <PlayerControllerOnline>(); }