PlayerCoinCollectorComponent.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #pragma once
  8. #include <AzFramework/Physics/Common/PhysicsEvents.h>
  9. #include <Source/AutoGen/PlayerCoinCollectorComponent.AutoComponent.h>
  10. namespace MultiplayerSample
  11. {
  12. class PlayerCoinCollectorComponentController
  13. : public PlayerCoinCollectorComponentControllerBase
  14. {
  15. public:
  16. explicit PlayerCoinCollectorComponentController(PlayerCoinCollectorComponent& parent);
  17. void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  18. void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  19. private:
  20. #if AZ_TRAIT_SERVER
  21. void OnTriggerEvents(const AzPhysics::TriggerEventList& tel);
  22. AzPhysics::SceneEvents::OnSceneTriggersEvent::Handler m_trigger{ [this](
  23. AzPhysics::SceneHandle, const AzPhysics::TriggerEventList& tel)
  24. {
  25. OnTriggerEvents(tel);
  26. } };
  27. #endif
  28. void OnCoinsChanged(uint16_t coins);
  29. AZ::Event<uint16_t>::Handler m_coinCountChangedHandler{ [this](uint16_t coins)
  30. {
  31. OnCoinsChanged(coins);
  32. } };
  33. };
  34. }