You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/GameStateSamples/Code/Include/GameStateSamples/GameStateLevelPaused.h

89 lines
3.8 KiB
C++

/*
* 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.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <GameState/GameState.h>
#include <AzFramework/Input/Events/InputChannelEventListener.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace GameStateSamples
{
////////////////////////////////////////////////////////////////////////////////////////////////
//! Game state that is active while gameplay is paused.
class GameStateLevelPaused : public GameState::IGameState
, public AzFramework::InputChannelEventListener
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
// Allocator
AZ_CLASS_ALLOCATOR(GameStateLevelPaused, AZ::SystemAllocator, 0);
////////////////////////////////////////////////////////////////////////////////////////////
// Type Info
AZ_RTTI(GameStateLevelPaused, "{6CAA4810-AA67-4A96-BB23-3EFA4BCCBF12}", IGameState);
////////////////////////////////////////////////////////////////////////////////////////////
//! Default constructor
GameStateLevelPaused() = default;
////////////////////////////////////////////////////////////////////////////////////////////
//! Default destructor
~GameStateLevelPaused() override = default;
protected:
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref GameState::GameState::OnPushed
void OnPushed() override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref GameState::GameState::OnPopped
void OnPopped() override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref GameState::GameState::OnEnter
void OnEnter() override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref GameState::GameState::OnExit
void OnExit() override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputChannelEventListener::GetPriority
AZ::s32 GetPriority() const override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputChannelEventListener::OnInputChannelEventFiltered
bool OnInputChannelEventFiltered(const AzFramework::InputChannel & inputChannel) override;
////////////////////////////////////////////////////////////////////////////////////////////
//! Convenience functions to load and unload the pause menu UI canvas.
///@{
virtual void LoadPauseMenuCanvas();
virtual void UnloadPauseMenuCanvas();
virtual void SetPauseMenuCanvasDrawOrder();
virtual const char* GetPauseMenuCanvasAssetPath();
///@}
////////////////////////////////////////////////////////////////////////////////////////////
//! Convenience functions to pause and unpause the game.
///@{
virtual void PauseGame();
virtual void UnpauseGame();
///@}
protected:
////////////////////////////////////////////////////////////////////////////////////////////
// Variables
AZ::EntityId m_pauseMenuCanvasEntityId; //!< Id of the UI canvas being displayed
};
} // namespace GameStateSamples
// Include the implementation inline so the class can be instantiated outside of the gem.
#include <GameStateSamples/GameStateLevelPaused.inl>