public void GetHitOnServer(GameObject tar) { SetTarget(tar); inCombat = true; rbody.bodyType = RigidbodyType2D.Dynamic; foreach (uint idmb in teammates) { MobBehaviour mb = NetworkIdentity.spawned[idmb].gameObject.GetComponent <MobBehaviour>(); mb.SetTarget(tar); mb.inCombat = true; mb.rbody.bodyType = RigidbodyType2D.Dynamic; } }
public void GetHit(Collider2D collision) { if (collision.transform.parent != null) { //collision is the player(players weapon to be exact) if (collision.transform.name == "Weapon") { SetTarget(collision.transform.parent.gameObject); inCombat = true; rbody.bodyType = RigidbodyType2D.Dynamic; foreach (uint idmb in teammates) { MobBehaviour mb = NetworkIdentity.spawned[idmb].gameObject.GetComponent <MobBehaviour>(); mb.SetTarget(collision.transform.parent.gameObject); mb.inCombat = true; mb.rbody.bodyType = RigidbodyType2D.Dynamic; } target.GetComponent <PlayerRpg>().Attack(gameObject); } } }