EBus interface used to submit requests related to game state management.
More...
#include <GameStateRequestBus.h>
Inherits AZ::EBusTraits.
|
|
static const AZ::EBusAddressPolicy | AddressPolicy = AZ::EBusAddressPolicy::Single |
|
static const AZ::EBusHandlerPolicy | HandlerPolicy = AZ::EBusHandlerPolicy::Single |
|
EBus interface used to submit requests related to game state management.
◆ AddGameStateFactoryOverrideForType()
template<class GameStateType >
bool GameState::GameStateRequests::AddGameStateFactoryOverrideForType |
( |
GameStateFactory |
factory | ) |
|
|
inlinestatic |
Add a game state override so that a request to push a new game state of a certain type will result in pushing a new game state of a different type instead. This is useful for situations where we want to use a set of default game states but override some (or all) of them with custom versions which satisfy the requirements of a specific game project.
- Template Parameters
-
GameStateType | The original game state type to be overridden |
- Parameters
-
[in] | factory | The factory function that will create the game state override |
- Returns
- True if the game state override was successfully added, false otherwise
◆ AddGameStateFactoryOverrideForTypeId()
virtual bool GameState::GameStateRequests::AddGameStateFactoryOverrideForTypeId |
( |
const AZ::TypeId & |
gameStateTypeId, |
|
|
GameStateFactory |
factory |
|
) |
| |
|
pure virtual |
Add a game state override so that a request to push a new game state of a certain type will result in pushing a new game state of a derived type instead. This is useful for situations where we want to use a set of default game states but override some (or all) of them with custom versions which satisfy the requirements of a specific game project.
- Parameters
-
[in] | gameStateTypeId | The original game state type id to be overridden |
[in] | factory | The factory function that will create the game state override |
- Returns
- True if the game state override was successfully added, false otherwise
◆ CreateAndPushNewOverridableGameStateOfType()
template<class GameStateType >
void GameState::GameStateRequests::CreateAndPushNewOverridableGameStateOfType |
( |
bool |
checkForOverride = true | ) |
|
|
inlinestatic |
Create a new game state and push it onto the stack to make it the active game state. New game states are created and stored in the stack using a shared_ptr, so they will be destroyed automatically once they are popped off the stack (assuming that nothing else retains a reference, say via GameStateNotifications::OnActiveGameStateChanged).
- Template Parameters
-
GameStateType | The game state type to create and activate |
- Parameters
-
[in] | checkForOverrides | True if we should check for an override, false otherwise |
◆ CreateNewOverridableGameStateOfType()
template<class GameStateType >
AZStd::shared_ptr< IGameState > GameState::GameStateRequests::CreateNewOverridableGameStateOfType |
( |
bool |
checkForOverride = true | ) |
|
|
inlinestatic |
Create a new game state
- Template Parameters
-
GameStateType | The game state type to create |
- Parameters
-
[in] | checkForOverrides | True if we should check for an override, false otherwise |
- Returns
- A shared pointer to the new game state that was created
◆ DoesStackContainGameStateOfType()
template<class GameStateType >
bool GameState::GameStateRequests::DoesStackContainGameStateOfType |
|
inlinestatic |
Query whether the game state stack contains a game state of the specified type
- Template Parameters
-
GameStateType | The game state type to check whether is in the stack |
- Returns
- True if the stack contains a game state of the specified type, false otherwise
◆ DoesStackContainGameStateOfTypeId()
virtual bool GameState::GameStateRequests::DoesStackContainGameStateOfTypeId |
( |
const AZ::TypeId & |
gameStateTypeId | ) |
|
|
pure virtual |
Query whether the game state stack contains a game state of the specified type
- Parameters
-
[in] | gameStateTypeId | The game state type to check whether is in the stack |
- Returns
- True if the stack contains a game state of the specified type, false otherwise
◆ GetActiveGameState()
virtual AZStd::shared_ptr<IGameState> GameState::GameStateRequests::GetActiveGameState |
( |
| ) |
|
|
pure virtual |
Request the active game state (if any)
- Returns
- A shared pointer to the active game state (will be empty if there is none)
◆ GetGameStateFactoryOverrideForType()
template<class GameStateType >
GameStateFactory GameState::GameStateRequests::GetGameStateFactoryOverrideForType |
|
inlinestatic |
Retrieve a game state override that was added using AddGameStateFactoryOverrideForType.
- Template Parameters
-
GameStateType | The original game state type that was overridden |
- Returns
- The factory function used to create the game state override, nullptr otherwise
◆ GetGameStateFactoryOverrideForTypeId()
virtual GameStateFactory GameState::GameStateRequests::GetGameStateFactoryOverrideForTypeId |
( |
const AZ::TypeId & |
gameStateTypeId | ) |
|
|
pure virtual |
Retrieve a game state override that was added using AddGameStateFactoryOverrideForTypeId.
- Parameters
-
[in] | gameStateTypeId | The original game state type id that was overridden |
- Returns
- The factory function used to create the game state override, nullptr otherwise
◆ IsActiveGameStateOfType()
template<class GameStateType >
bool GameState::GameStateRequests::IsActiveGameStateOfType |
|
inlinestatic |
Query whether the active game state is of the specified type
- Template Parameters
-
GameStateType | The game state type to check whether is active |
- Returns
- True if the active game state is of the specified type, false otherwise
◆ PopActiveGameState()
virtual bool GameState::GameStateRequests::PopActiveGameState |
( |
| ) |
|
|
pure virtual |
Pop the active game state from the stack, which will result in it being deactivated and the game state below it in the stack (if any) becoming the active game state again.
- Returns
- True if the active game state was successfully popped, false otherwise
◆ PopActiveGameStateUntilOfType()
template<class GameStateType >
bool GameState::GameStateRequests::PopActiveGameStateUntilOfType |
|
inlinestatic |
Pop game states from the stack until the active game state is of the specified type. If no game state of the specified type exists in the game state stack it will be left empty.
- Template Parameters
-
GameStateType | The game state type in the stack that we want to be active |
- Returns
- True if the active game state is now of the specified type, false otherwise
◆ PushGameState()
virtual bool GameState::GameStateRequests::PushGameState |
( |
AZStd::shared_ptr< IGameState > |
newGameState | ) |
|
|
pure virtual |
Push a game state onto the stack, which will result in it becoming the active game state. If newGameState is already found in the stack this will fail and return false, however it is possible for multiple instances of the same game state type to occupy the stack.
- Parameters
-
[in] | newGameState | The new game state to push onto the stack |
- Returns
- True if the game state was successfully pushed onto the stack, false otherwise
◆ RemoveGameStateFactoryOverrideForType()
template<class GameStateType >
bool GameState::GameStateRequests::RemoveGameStateFactoryOverrideForType |
|
inlinestatic |
Remove a game state override that was added using AddGameStateFactoryOverrideForType.
- Template Parameters
-
GameStateType | The original game state type that was overridden |
- Returns
- True if the game state override was successfully removed, false otherwise
◆ RemoveGameStateFactoryOverrideForTypeId()
virtual bool GameState::GameStateRequests::RemoveGameStateFactoryOverrideForTypeId |
( |
const AZ::TypeId & |
gameStateTypeId | ) |
|
|
pure virtual |
Remove a game state override that was added using AddGameStateFactoryOverrideForTypeId.
- Parameters
-
[in] | gameStateTypeId | The original game state type id that was overridden |
- Returns
- True if the game state override was successfully removed, false otherwise
◆ ReplaceActiveGameState()
virtual bool GameState::GameStateRequests::ReplaceActiveGameState |
( |
AZStd::shared_ptr< IGameState > |
newGameState | ) |
|
|
pure virtual |
Replace the active game state with another game state that will become the active state. If the stack is currently empty, newGameState will be pushed to become the active state. If newGameState is already found in the stack this will fail and return false, however it is possible for multiple instances of the same game state type to occupy the stack. This differs from calling PopActiveGameState followed by PushGameState(newGameState), which would result in the state below the currently active state being activated then immediately deactivated when newGameState is pushed onto the stack; calling this will the state below the currently active state unchanged.
- Parameters
-
[in] | newGameState | The new game state with which to replace the active game state |
- Returns
- True if the active game state was successfully replaced, false otherwise
◆ UpdateActiveGameState()
virtual void GameState::GameStateRequests::UpdateActiveGameState |
( |
| ) |
|
|
pure virtual |
Update the active game state. This is called during the AZ::ComponentTickBus::TICK_GAME priority update of the AZ::TickBus, but can be called independently any time if needed.
◆ AddressPolicy
const AZ::EBusAddressPolicy GameState::GameStateRequests::AddressPolicy = AZ::EBusAddressPolicy::Single |
|
static |
EBus Trait: requests can only be sent to and addressed by a single instance (singleton)
The documentation for this class was generated from the following file:
- Gems/GameState/Code/Include/GameState/GameStateRequestBus.h