A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
GameManager.cpp
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
4
8#include "GameFramework/GameModeBase.h"
11
18
19void UGameManager::OnTeleportActivatedRaw_Implementation(EControllerHand Hand, bool InActivate)
20{
21}
22
24{
25 CurrentStep = Event->CurrentStep.StepName;
27}
28
30{
31 CurrentStep = Event->CurrentStep.StepName;
33}
34
36{
37 GameModeBaseRef = GetWorld()->GetAuthGameMode();
38 if (GameModeBaseRef->GetClass()->ImplementsInterface(UPixoCoreInterface::StaticClass()))
39 {
40 SoundManagerRef = Cast<USoundManager>(IPixoCoreInterface::Execute_GetManagerRef(GameModeBaseRef, USoundManager::StaticClass()));
41 if (!SoundManagerRef)
42 {
43 UE_LOG(LogTemp, Error, TEXT("Sound Manager has not been setup for this project!"));
44 }
45
46 StoryManagerRef = Cast<UStoryManager>(IPixoCoreInterface::Execute_GetManagerRef(GameModeBaseRef, UStoryManager::StaticClass()));
47 if (!StoryManagerRef)
48 {
49 UE_LOG(LogTemp, Error, TEXT("Story Manager has not been setup for this project!"));
50 }
51 }
52 else
53 UE_LOG(LogTemp, Error, TEXT("Game mode doesn't implement PixoCore Interface"));
54
55 PlayerPawnRef = Cast<APixoVRCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn());
56 if (PlayerPawnRef)
57 {
59 }
60 else
61 UE_LOG(LogTemp, Error, TEXT("PlayerPawn reference is invalid!"));
62
64 {
66 {
67 return;
68 }
69 for (auto StoryScript : StoryScriptClassData->ScriptData)
70 {
71 UStoryScript* TempScript = NewObject<UStoryScript>(this, StoryScript.StepScriptClass);
72 ScriptInstancesData.Add(FScriptInstanceData(StoryScript.StepName, TempScript));
73 TempScript->ScriptInitialization();
74 }
75 }
76}
#define DEFINE_EVENT_HANDLER(TEventType)
Definition BaseManager.h:13
FOnTeleportationActivated & OnTeleportationActivated()
void HandleEvent_Impl(class UBaseEvent *Event)
FText CurrentStep
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
Definition GameManager.h:68
void OnTeleportActivatedRaw(EControllerHand Hand, bool InActivate)
Function for overriding. Called when teleportation is activated.
AGameModeBase * GameModeBaseRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
Definition GameManager.h:92
void OnNewStepLoaded(const FText &StepName)
Function for overriding. Called when a new step is loaded.
TArray< FScriptInstanceData > ScriptInstancesData
UPROPERTY(BlueprintReadOnly, Category = "GamaManager|Script")
APixoVRCharacter * PlayerPawnRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
Definition GameManager.h:86
UStoryManager * StoryManagerRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
Definition GameManager.h:80
UStoryScriptClassData * StoryScriptClassData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GameManager|Script")
Definition GameManager.h:99
bool IsUsingStoryScriptData
UPROPERTY(EditDefaultsOnly, Category = "GameManager|Script")
USoundManager * SoundManagerRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
Definition GameManager.h:74
void OnNewStoryLoaded(const FText &StepName)
Function for overriding. Called when a new story is loaded.
Event called when we on init experience.
Event called when new step is loaded.
Event called when new story is loaded.
TArray< FScriptClassData > ScriptData
UPROPERTY(EditAnywhere)
Definition StoryScript.h:91
UCLASS(BlueprintType, Blueprintable, meta = (ShowWorldContexPin))
void ScriptInitialization()
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Script")
Struct for holding script instance data.
Definition StoryScript.h:47