// Applies damage to the given <target>. private void AttackTarget(Transform target) { // Trigger the attack animation. thisNetworkAnimator.SetTrigger("Attack"); if (target.tag == "Barricade") { Barricade targetBarricade = target.GetComponent <Barricade>(); // Damage the Barricade over the Network. targetBarricade.CmdDamageBarricade(attackDamage); } else { NetworkUser targetPlayer = target.GetComponent <NetworkUser>(); // Damage the Player over the Network. targetPlayer.CmdDamagePlayer(attackDamage); } // Reset the attack timer so we can attack again. attackTimer = 0f; }