UiPlayerArmorComponent.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <UiPlayerArmorBus.h>
  10. #include <PlayerIdentityBus.h>
  11. #include <AzCore/Component/Component.h>
  12. namespace MultiplayerSample
  13. {
  14. class UiPlayerArmorComponent
  15. : public AZ::Component
  16. , public UiPlayerArmorNotificationBus::Handler
  17. , public PlayerIdentityNotificationBus::Handler
  18. {
  19. public:
  20. AZ_COMPONENT(UiPlayerArmorComponent, "{15de84e4-eb35-4c9a-a0e3-9e39c10a7ff4}");
  21. static void Reflect(AZ::ReflectContext* context);
  22. void Activate() override;
  23. void Deactivate() override;
  24. //! UiPlayerArmorNotificationBus overrides ...
  25. //! @{
  26. void OnPlayerArmorChanged(float armorPointsForLocalPlayer, float startingArmor) override;
  27. //! @}
  28. //! PlayerIdentityNotificationBus overrides ...
  29. //! @{
  30. void OnAutonomousPlayerNameChanged(const char* playerName) override;
  31. //! @}
  32. private:
  33. // UI entities
  34. AZ::EntityId m_rootElement;
  35. AZ::EntityId m_playerName;
  36. AZ::EntityId m_armorVisualEntity;
  37. AZ::EntityId m_armorText;
  38. };
  39. } // namespace MultiplayerSample