4#include "GameFramework/PlayerController.h"
5#include "Engine/World.h"
15PRAGMA_DISABLE_OPTIMIZATION
25 FRWScopeLock(
Lock, SLT_Write);
38 if (
APixoVRGameState* GameState = GetWorld() !=
nullptr ? GetWorld()->GetGameState<APixoVRGameState>() :
nullptr)
40 GameState->ServerStartGameSession();
48 FRWScopeLock(
Lock, SLT_Write);
67 FRWScopeLock(
Lock, SLT_Write);
89 if (Manager->IsA(ManagerClass))
103 FRWScopeLock(
Lock, SLT_ReadOnly);
105 TArray<UBaseEvent*> OutEvents;
118 if (ensureMsgf(Event !=
nullptr, TEXT(
"[UExperienceManager::DispatchEvent] Event is NULL")))
123 Listener->HandleEvent(Event);
127 Listener->HandleEvent(Event);
133PRAGMA_ENABLE_OPTIMIZATION
APixoVRGameState is a custom game state class that extends AGameState.
static EventContainer & Events()
static FUNCTION_NON_NULL_RETURN_START TEventType * NewEvent(APlayerController *Executor=nullptr) FUNCTION_NON_NULL_RETURN_END
Creates a new event of the specified type.
The UBaseEvent class serves as the base class for all events for our event-managers system....
virtual void Unlock() final
virtual bool Lock() final
It provides functionalities for handling events, sending events, and managing a private owner....
APlayerController * GetPrivateOwner() const
virtual void EndExperience()
This function handles any pending events in the game experience by calling the HandleEvents function.
TArray< TSubclassOf< UBaseManager > > PerPlayerListenerClasses
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Classes, DisplayName = MultipleInstanceLis...
virtual void JoinExperience(uint8 PlayerIndex, APlayerController *NewPlayer)
This function adds per-player listeners to the PerPlayerListeners array by creating new manager insta...
virtual void LeaveExperience(AController *LeavingPlayer, uint8 PlayersLeft)
This function removes the per-player listeners associated with the leaving player from the PerPlayerL...
void DispatchEvent(UBaseEvent *Event) const
This function dispatches the specified Event to the listeners. It ensures that the event is not null ...
TArray< UBaseManager * > SingleListeners
UPROPERTY()
virtual UBaseManager * GetManagerRef_Implementation(TSubclassOf< UBaseManager > ManagerClass) override
This function searches for a single-instance listener of the specified ManagerClass in the SingleList...
virtual void HandleEvent(UBaseEvent *Event)
void HandleEvents()
This function is responsible for handling pending events in the game experience. It retrieves the pen...
TArray< UBaseManager * > PerPlayerListeners
UPROPERTY()
TArray< TSubclassOf< UBaseManager > > SingleListenerClasses
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Classes, DisplayName = SingleInstanceListe...
virtual void TickExperience(float DeltaTime)
This function is called every frame to handle events in the game experience. It calls the HandleEvent...
virtual void StartExperience()
This function starts the game experience by calling the ServerStartGameSession function on the APixoV...
virtual void InitExperience()
This function initializes the game experience by creating and adding single-instance listeners to the...