The UExperienceManager serves as the manager for handling the overall game experience. The class manages the initialization, start, join, tick, leave, and end operations of the game experience. It also handles events and provides access to different managers.
More...
#include <ExperienceManager.h>
|
| UExperienceManager () |
|
virtual void | EndExperience () |
| This function handles any pending events in the game experience by calling the HandleEvents function.
|
|
UBaseManager * | GetManagerRef (TSubclassOf< UBaseManager > ManagerClass) |
| Retrieves a reference to the specified manager class.
|
|
virtual UBaseManager * | GetManagerRef_Implementation (TSubclassOf< UBaseManager > ManagerClass) override |
| This function searches for a single-instance listener of the specified ManagerClass in the SingleListeners array. If a matching manager is found, a pointer to it is returned. Otherwise, nullptr is returned.
|
|
UStoryManager * | GetStoryManager () |
| Retrieves the story manager.
|
|
UStreamingLevelManager * | GetStreamingLevelManager () |
| Retrieves the streaming level manager.
|
|
virtual void | InitExperience () |
| This function initializes the game experience by creating and adding single-instance listeners to the SingleListeners array. It triggers the UInitializationEvent event to indicate that the experience has been initialized.
|
|
virtual void | JoinExperience (uint8 PlayerIndex, APlayerController *NewPlayer) |
| This function adds per-player listeners to the PerPlayerListeners array by creating new manager instances using the NewManager function. It triggers the UPlayerJoinedEvent event to indicate that a player has joined the experience.
|
|
virtual void | LeaveExperience (AController *LeavingPlayer, uint8 PlayersLeft) |
| This function removes the per-player listeners associated with the leaving player from the PerPlayerListeners array. If there are no more players left, it triggers the UClearExperienceEvent event to indicate that the experience should be cleared.
|
|
virtual void | PrepareScenario (APlayerController *NewPlayer) |
|
virtual void | StartExperience () |
| This function starts the game experience by calling the ServerStartGameSession function on the APixoVRGameState instance in the world. It also triggers the UStartPlayEvent event.
|
|
virtual void | TickExperience (float DeltaTime) |
| This function is called every frame to handle events in the game experience. It calls the HandleEvents function to process pending events.
|
|
|
void | DispatchEvent (UBaseEvent *Event) const |
| This function dispatches the specified Event to the listeners. It ensures that the event is not null and then locks the event before calling the HandleEvent function on each single-instance listener in the SingleListeners array and each per-player listener in the PerPlayerListeners array. After processing the event, the event is unlocked.
|
|
| GENERATED_BODY () |
|
void | HandleEvents () |
| This function is responsible for handling pending events in the game experience. It retrieves the pending events from the EventLogService, processes each event by calling the HandleEvent function, and then dispatches the event to the appropriate listeners using the DispatchEvent function.
|
|
The UExperienceManager serves as the manager for handling the overall game experience. The class manages the initialization, start, join, tick, leave, and end operations of the game experience. It also handles events and provides access to different managers.
UCLASS(Blueprintable)
Definition at line 24 of file ExperienceManager.h.
◆ UExperienceManager()
PRAGMA_DISABLE_OPTIMIZATION UExperienceManager::UExperienceManager |
( |
| ) |
|
◆ DispatchEvent()
void UExperienceManager::DispatchEvent |
( |
UBaseEvent * | Event | ) |
const |
|
private |
This function dispatches the specified Event to the listeners. It ensures that the event is not null and then locks the event before calling the HandleEvent function on each single-instance listener in the SingleListeners array and each per-player listener in the PerPlayerListeners array. After processing the event, the event is unlocked.
- See also
- HandleEvent
-
SingleListeners
-
PerPlayerListeners
- Parameters
-
Event | The event to dispatch. |
Definition at line 116 of file ExperienceManager.cpp.
◆ EndExperience()
void UExperienceManager::EndExperience |
( |
| ) |
|
|
virtual |
This function handles any pending events in the game experience by calling the HandleEvents function.
Definition at line 80 of file ExperienceManager.cpp.
◆ GENERATED_BODY()
UExperienceManager::GENERATED_BODY |
( |
| ) |
|
|
private |
◆ GetManagerRef()
|
inheritedBlueprintCallableBlueprintNativeEvent |
Retrieves a reference to the specified manager class.
- Parameters
-
ManagerClass | The class of the manager to retrieve. |
- Returns
- A pointer to the manager instance.
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Manager")
◆ GetManagerRef_Implementation()
This function searches for a single-instance listener of the specified ManagerClass in the SingleListeners array. If a matching manager is found, a pointer to it is returned. Otherwise, nullptr is returned.
- Parameters
-
ManagerClass | The class of the manager to retrieve. |
- Returns
- A pointer to the matching manager, or nullptr if not found.
UFUNCTION()
Definition at line 85 of file ExperienceManager.cpp.
◆ GetStoryManager()
|
inheritedBlueprintCallableBlueprintNativeEvent |
Retrieves the story manager.
- Returns
- The story manager instance.
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Manager")
◆ GetStreamingLevelManager()
|
inheritedBlueprintCallableBlueprintNativeEvent |
Retrieves the streaming level manager.
- Returns
- The streaming level manager instance.
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Manager")
◆ HandleEvent()
void UExperienceManager::HandleEvent |
( |
UBaseEvent * | Event | ) |
|
|
protectedvirtual |
◆ HandleEvents()
void UExperienceManager::HandleEvents |
( |
| ) |
|
|
private |
This function is responsible for handling pending events in the game experience. It retrieves the pending events from the EventLogService, processes each event by calling the HandleEvent function, and then dispatches the event to the appropriate listeners using the DispatchEvent function.
- See also
- EventLogService
-
HandleEvent
-
DispatchEvent
Definition at line 101 of file ExperienceManager.cpp.
◆ InitExperience()
void UExperienceManager::InitExperience |
( |
| ) |
|
|
virtual |
◆ JoinExperience()
void UExperienceManager::JoinExperience |
( |
uint8 | PlayerIndex, |
|
|
APlayerController * | NewPlayer ) |
|
virtual |
This function adds per-player listeners to the PerPlayerListeners array by creating new manager instances using the NewManager function. It triggers the UPlayerJoinedEvent event to indicate that a player has joined the experience.
- See also
- UPlayerJoinedEvent
-
PerPlayerListeners
- Parameters
-
PlayerIndex | The index of the player joining the experience. |
NewPlayer | The player controller of the player joining the experience. |
Definition at line 45 of file ExperienceManager.cpp.
◆ LeaveExperience()
void UExperienceManager::LeaveExperience |
( |
AController * | LeavingPlayer, |
|
|
uint8 | PlayersLeft ) |
|
virtual |
This function removes the per-player listeners associated with the leaving player from the PerPlayerListeners array. If there are no more players left, it triggers the UClearExperienceEvent event to indicate that the experience should be cleared.
- See also
- UClearExperienceEvent
-
PerPlayerListeners
- Parameters
-
LeavingPlayer | The controller of the player leaving the experience. |
PlayersLeft | The number of players remaining in the experience. |
Definition at line 64 of file ExperienceManager.cpp.
◆ PrepareScenario()
virtual void UExperienceManager::PrepareScenario |
( |
APlayerController * | NewPlayer | ) |
|
|
inlinevirtual |
◆ StartExperience()
void UExperienceManager::StartExperience |
( |
| ) |
|
|
virtual |
◆ TickExperience()
void UExperienceManager::TickExperience |
( |
float | DeltaTime | ) |
|
|
virtual |
This function is called every frame to handle events in the game experience. It calls the HandleEvents function to process pending events.
- Parameters
-
DeltaTime | The time elapsed since the last tick. |
Definition at line 59 of file ExperienceManager.cpp.
◆ Lock
FRWLock UExperienceManager::Lock |
|
protected |
◆ PerPlayerListenerClasses
TArray<TSubclassOf<UBaseManager> > UExperienceManager::PerPlayerListenerClasses |
|
protectedEditDefaultsOnlyBlueprintReadWrite |
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Classes, DisplayName = MultipleInstanceListeners)
Classes for different event-based managers which creates per player.
Definition at line 126 of file ExperienceManager.h.
◆ PerPlayerListeners
TArray<UBaseManager*> UExperienceManager::PerPlayerListeners |
|
protected |
UPROPERTY()
Array for different event-based managers which creates per player.
Definition at line 135 of file ExperienceManager.h.
◆ SingleListenerClasses
TArray<TSubclassOf<UBaseManager> > UExperienceManager::SingleListenerClasses = {UFadeManager::StaticClass()} |
|
protectedEditDefaultsOnlyBlueprintReadWrite |
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Classes, DisplayName = SingleInstanceListeners)
Classes of for different event-based managers, used in game.
Definition at line 119 of file ExperienceManager.h.
◆ SingleListeners
UPROPERTY()
Array of for different event-based managers, used in game.
Definition at line 131 of file ExperienceManager.h.
The documentation for this class was generated from the following files: