private void HitHandler(BoltEntity targetEntity, int weaponAmount, WeaponType weaponType, Vector3 hit) { // If we are not the owner if the target entity, just return, we can do nothing if (targetEntity.IsOwner == false) { return; } // Ignore if we try to hit ourself if (targetEntity.Equals(entity)) { return; } // Get Player State var moveAndShootPlayerState = targetEntity.GetState <IMoveAndShootPlayer>(); var healthChange = 0; switch (weaponType) { case WeaponType.HEAL: // Ignore if is the other Team if (moveAndShootPlayerState.Team != state.Team) { return; } // Increase health healthChange = weaponAmount; break; case WeaponType.DAMAGE: // Ignore if is the same Team if (moveAndShootPlayerState.Team == state.Team) { return; } // Decrease health healthChange = -weaponAmount; break; } // Get Current Health and Apply weapon change var targetHealth = moveAndShootPlayerState.Health + healthChange; // Clamp result value a put back on the state moveAndShootPlayerState.Health = Mathf.Clamp(targetHealth, 0, 100); // Send FX Event var hitInfoToken = ProtocolTokenUtils.GetToken <HitInfo>(); hitInfoToken.hitPosition = hit; hitInfoToken.hitType = healthChange > 0; MoveAndShootHitEvent.Post(GlobalTargets.Everyone, ReliabilityModes.ReliableOrdered, hitInfoToken); }