GameStateMatchEnded.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <Components/NetworkMatchComponent.h>
  9. #include <GameState/GameState.h>
  10. namespace MultiplayerSample
  11. {
  12. class GameStateMatchEnded
  13. : public GameState::IGameState
  14. {
  15. public:
  16. AZ_CLASS_ALLOCATOR(GameStateMatchEnded, AZ::SystemAllocator, 0);
  17. AZ_RTTI(GameStateMatchEnded, "{57dea8df-1286-4f65-ae4f-d4aab858428b}", IGameState);
  18. explicit GameStateMatchEnded(NetworkMatchComponentController* controller);
  19. GameStateMatchEnded() = default;
  20. //! GameState::IGameState overrides ...
  21. //! @{
  22. void OnEnter() override;
  23. void OnExit() override;
  24. //! }@
  25. private:
  26. #if AZ_TRAIT_SERVER
  27. NetworkMatchComponentController* m_controller = nullptr;
  28. #endif
  29. AZ::TimeMs m_finishingTime = AZ::Time::ZeroTimeMs;
  30. void OnFinishedMatchTick();
  31. AZ::ScheduledEvent m_finishingEvent{ [this]()
  32. {
  33. OnFinishedMatchTick();
  34. }, AZ::Name("GameStateMatchEnded") };
  35. };
  36. }