NetworkHealthComponent.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0 OR MIT
  5. *
  6. */
  7. #include <Source/Components/NetworkHealthComponent.h>
  8. namespace ${SanitizedCppName}
  9. {
  10. NetworkHealthComponentController::NetworkHealthComponentController(NetworkHealthComponent& parent)
  11. : NetworkHealthComponentControllerBase(parent)
  12. {
  13. }
  14. void NetworkHealthComponentController::OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating)
  15. {
  16. ;
  17. }
  18. void NetworkHealthComponentController::OnDeactivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating)
  19. {
  20. ;
  21. }
  22. #if AZ_TRAIT_SERVER
  23. void NetworkHealthComponentController::HandleSendHealthDelta([[maybe_unused]] AzNetworking::IConnection* invokingConnection, const float& healthDelta)
  24. {
  25. float health = GetHealth();
  26. health = AZStd::max(0.0f, AZStd::min(GetMaxHealth(), health + healthDelta));
  27. SetHealth(health);
  28. }
  29. #endif
  30. }