public void CmdShoot(Vector3 start, Vector3 end, GameObject victim) { if (victim) { Shooting enemyShot = victim.GetComponent <Shooting>(); if (enemyShot) { enemyShot.CmdGetShot(); } else { Rigidbody rb = victim.GetComponent <Rigidbody>(); rb.AddForce((end - start).normalized * impactForce, ForceMode.VelocityChange); } } RpcShoot(start, end); }