void OnCollisionEnter(Collision col) { Debug.Log("OnColEnter" + PhotonNetwork.player.name); if (col.gameObject.tag == "Untagged" || col.gameObject.tag == "MyPlayer" || col.gameObject.tag == "Head" || col.gameObject.tag == "Legs" || col.gameObject.tag == "Stomach" || col.gameObject.tag == "BOT") { Instantiate(snegOstaci, col.contacts [0].point, Quaternion.identity); Explode(); } /*if (col.gameObject.tag == "MyPlayer") { * Health h = col.gameObject.GetComponentInParent<Health> (); * Debug.Log ("We hit us"); * if (h != null) { * //h.TakeDamage (HeadDMG); * h.GetComponent<PhotonView> ().RPC ("TakeDamage", PhotonTargets.AllBuffered, HeadDMG); * Debug.Log (h.HealthPoints); * } * }*/ if (col.gameObject.tag == "MyPlayer") { Explode(); } if (col.gameObject.tag == "BobsBack") { Health h = col.gameObject.GetComponentInParent <Health> (); Debug.Log("We hit enemys chest"); if (h != null) { //h.TakeDamage(ChestDMG); h.GetComponent <PhotonView> ().RPC("TakeDamage", PhotonTargets.All, BobsBackDMG); /*if(h.HealthPoints < 0) { * * scoreManager.GetComponent<PhotonView> ().RPC ("killsUp", PhotonTargets.AllBufferedViaServer, nick); * }*/ } } if (col.gameObject.tag == "Stomach") { Sounds s = col.gameObject.GetComponentInParent <Sounds> (); Health h = col.gameObject.GetComponentInParent <Health> (); Debug.Log("We hit enemys stomach"); if (h != null) { h.GetComponent <PhotonView> ().RPC("TakeDamage", PhotonTargets.All, StomachDMG); if (h.HealthPoints < 0) { scoreManager.GetComponent <PhotonView> ().RPC("test", PhotonTargets.AllBuffered, nick); } } if (netManager.Boy == true && netManager.Bob == false && netManager.Girl == false) { s.DamageBoy(); } if (netManager.Bob == true && netManager.Boy == false && netManager.Girl == false) { s.DamageBob(); } if (netManager.Girl == true && netManager.Boy == false && netManager.Bob == false) { s.DamageGirl(); } } if (col.gameObject.tag == "Head") { Sounds s = col.gameObject.GetComponentInParent <Sounds> (); Health h = col.gameObject.GetComponentInParent <Health> (); Debug.Log("Headshot!"); if (h != null) { h.GetComponent <PhotonView> ().RPC("TakeDamage", PhotonTargets.All, HeadDMG); if (h.HealthPoints < 0) { scoreManager.GetComponent <PhotonView> ().RPC("test", PhotonTargets.AllBuffered, nick); } h.HeadShotAnim(); } if (netManager.Boy == true && netManager.Bob == false && netManager.Girl == false) { s.DamageBoy(); } if (netManager.Bob == true && netManager.Boy == false && netManager.Girl == false) { s.DamageBob(); } if (netManager.Girl == true && netManager.Boy == false && netManager.Bob == false) { s.DamageGirl(); } } if (col.gameObject.tag == "Leg") { Sounds s = col.gameObject.GetComponentInParent <Sounds> (); Health h = col.gameObject.GetComponentInParent <Health> (); Debug.Log("We hit enemys leg"); if (h != null) { h.GetComponent <PhotonView> ().RPC("TakeDamage", PhotonTargets.All, LegDMG); if (h.HealthPoints < 0) { scoreManager.GetComponent <PhotonView> ().RPC("test", PhotonTargets.AllBuffered, nick); } } if (netManager.Boy == true && netManager.Bob == false && netManager.Girl == false) { s.DamageBoy(); } if (netManager.Bob == true && netManager.Boy == false && netManager.Girl == false) { s.DamageBob(); } if (netManager.Girl == true && netManager.Boy == false && netManager.Bob == false) { s.DamageGirl(); } } if (col.gameObject.tag == "BOT") { BotMovement bt = col.gameObject.GetComponentInParent <BotMovement> (); if (bt != null) { bt.Damage(); if (bt.HealthPoints <= 0f) { scoreManager.GetComponent <PhotonView> ().RPC("test", PhotonTargets.AllBuffered, nick); } } } }