A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
UExperienceManager Class ReferenceBlueprintable

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>

Inheritance diagram for UExperienceManager:
[legend]

Public Member Functions

 UExperienceManager ()
 
virtual void EndExperience ()
 This function handles any pending events in the game experience by calling the HandleEvents function.
 
UBaseManagerGetManagerRef (TSubclassOf< UBaseManager > ManagerClass)
 Retrieves a reference to the specified manager class.
 
virtual UBaseManagerGetManagerRef_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.
 
UStoryManagerGetStoryManager ()
 Retrieves the story manager.
 
UStreamingLevelManagerGetStreamingLevelManager ()
 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.
 

Protected Member Functions

virtual void HandleEvent (UBaseEvent *Event)
 

Protected Attributes

FRWLock Lock
 
TArray< TSubclassOf< UBaseManager > > PerPlayerListenerClasses
 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Classes, DisplayName = MultipleInstanceListeners)
 
TArray< UBaseManager * > PerPlayerListeners
 UPROPERTY()
 
TArray< TSubclassOf< UBaseManager > > SingleListenerClasses = {UFadeManager::StaticClass()}
 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Classes, DisplayName = SingleInstanceListeners)
 
TArray< UBaseManager * > SingleListeners
 UPROPERTY()
 

Private Member Functions

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ UExperienceManager()

PRAGMA_DISABLE_OPTIMIZATION UExperienceManager::UExperienceManager ( )

Definition at line 17 of file ExperienceManager.cpp.

Member Function Documentation

◆ 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
EventThe event to dispatch.

Definition at line 116 of file ExperienceManager.cpp.

Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:

◆ GENERATED_BODY()

UExperienceManager::GENERATED_BODY ( )
private

◆ GetManagerRef()

UBaseManager * IPixoCoreInterface::GetManagerRef ( TSubclassOf< UBaseManager > ManagerClass)
inheritedBlueprintCallableBlueprintNativeEvent

Retrieves a reference to the specified manager class.

Parameters
ManagerClassThe class of the manager to retrieve.
Returns
A pointer to the manager instance.

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Manager")

◆ GetManagerRef_Implementation()

UBaseManager * UExperienceManager::GetManagerRef_Implementation ( TSubclassOf< UBaseManager > ManagerClass)
overridevirtual

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
ManagerClassThe 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()

UStoryManager * IPixoCoreInterface::GetStoryManager ( )
inheritedBlueprintCallableBlueprintNativeEvent

Retrieves the story manager.

Returns
The story manager instance.

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Manager")

◆ GetStreamingLevelManager()

UStreamingLevelManager * IPixoCoreInterface::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

Definition at line 97 of file ExperienceManager.cpp.

Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitExperience()

void UExperienceManager::InitExperience ( )
virtual

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.

See also
UInitializationEvent
SingleListeners

Definition at line 22 of file ExperienceManager.cpp.

Here is the caller graph for this function:

◆ 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
PlayerIndexThe index of the player joining the experience.
NewPlayerThe 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
LeavingPlayerThe controller of the player leaving the experience.
PlayersLeftThe number of players remaining in the experience.

Definition at line 64 of file ExperienceManager.cpp.

Here is the call graph for this function:

◆ PrepareScenario()

virtual void UExperienceManager::PrepareScenario ( APlayerController * NewPlayer)
inlinevirtual

Definition at line 73 of file ExperienceManager.h.

◆ StartExperience()

void UExperienceManager::StartExperience ( )
virtual

This function starts the game experience by calling the ServerStartGameSession function on the APixoVRGameState instance in the world. It also triggers the UStartPlayEvent event.

See also
UStartPlayEvent

Definition at line 36 of file ExperienceManager.cpp.

◆ 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
DeltaTimeThe time elapsed since the last tick.

Definition at line 59 of file ExperienceManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ Lock

FRWLock UExperienceManager::Lock
protected

Definition at line 137 of file ExperienceManager.h.

◆ PerPlayerListenerClasses

TArray<TSubclassOf<UBaseManager> > UExperienceManager::PerPlayerListenerClasses
protectedBlueprintReadWriteEditDefaultsOnly

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()}
protectedBlueprintReadWriteEditDefaultsOnly

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

TArray<UBaseManager*> UExperienceManager::SingleListeners
protected

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: