8#include "GameFramework/GameModeBase.h"
10#include "Kismet/GameplayStatics.h"
57 UStoryScript* TempScript = NewObject<UStoryScript>(
this, StoryScript.StepScriptClass);
99 if (UWorld* World = GetWorld())
101 UGameplayStatics::GetAllActorsOfClass(World, TargetClass, OutActors);
105void UGameManager::OnInitialization_Implementation()
117 for (
auto const & InteractableObjectData : InteractableObjectDataBase->InteractiveObjectData)
119 if (TargetActor->IsA(InteractableObjectData.InteractiveObject))
126 TArray<AActor*> ChildActorsArray;
127 TargetActor->GetAllChildActors(ChildActorsArray);
128 for (
auto const ChildActor : ChildActorsArray)
131 Cast<ABaseStoryActor>(ChildActor)->HighlightComponent->HighlightActiveOnSteps.Empty();
134 if (ChildActor->IsA(ChildClass))
136 Cast<ABaseStoryActor>(ChildActor)->ActiveStepsAcquiredFromParent =
true;
137 Cast<ABaseStoryActor>(ChildActor)->Story->ActiveSteps.Append(InteractableObjectData.StorySteps);
138 Cast<ABaseStoryActor>(ChildActor)->HighlightComponent->HighlightActiveOnSteps.Append(InteractableObjectData.HighlightSteps);
150void UGameManager::OnGrabbingWrongActor_Implementation(
AActor* WrongActor)
154void UGameManager::OnTeleportActivatedRaw_Implementation(EControllerHand Hand,
bool InActivate)
173 if (
GameModeBaseRef->GetClass()->ImplementsInterface(UPixoCoreInterface::StaticClass()))
178 UE_LOG(LogTemp, Error, TEXT(
"Sound Manager has not been setup for this project!"));
188 UE_LOG(LogTemp, Error, TEXT(
"Game mode doesn't implement PixoCore Interface"));
190 PlayerPawnRef = Cast<APixoVRCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn());
196 UE_LOG(LogTemp, Error, TEXT(
"PlayerPawn reference is invalid!"));
#define DEFINE_EVENT_HANDLER(TEventType)
Base class for story actors.
UStoryComponent * Story
UPROPERTY(BlueprintReadWrite, EditAnywhere)
bool ActiveStepsAcquiredFromParent
bool IsAutoStepDataPopulationActive
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BaseStoryActor|DynamicStory")
TArray< TSubclassOf< ABaseStoryActor > > ChildClassesThatAcquiredPopulatedData
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "BaseStoryActor|DynamicStory",...
UHighlightComponent * HighlightComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FOnTeleportationActivated & OnTeleportationActivated()
void HandleEvent_Impl(class UBaseEvent *Event)
FText CurrentStep
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
FOnNewInteractableItemAdded OnNewInteractableItemAdded
UPROPERTY(BlueprintAssignable, Category = "GameManager|Delegates")
void OnInitialization()
Function for overriding. Called when initialization ended.
void OnTeleportActivatedRaw(EControllerHand Hand, bool InActivate)
Function for overriding. Called when teleportation is activated.
FOnWrongInteractableActorGrabbed OnWrongInteractableActorGrabbed
UPROPERTY(BlueprintReadWrite, BlueprintCallable, BlueprintAssignable)
void SpawnStoryScripts()
UFUNCTION()
TArray< UStoryScriptClassData * > DynamicStoryScripts
UPROPERTY()
void NewDynamicStoryAdded(FDynamicStoryData DynamicStoryData)
UFUNCTION(BlueprintCallable, Category = "GameManager|DynamicStory")
void OnInteractiveItemAdded(ABaseStoryActor *AddedInteractiveItem)
Function for overriding. Called when the interactive item is added to InteractiveItemsArray.
AGameModeBase * GameModeBaseRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
void OnNewStepLoaded(const FText &StepName)
Function for overriding. Called when a new step is loaded.
void OnEndStoryReached()
UFUNCTION()
void GetAllActorsOfClass(TSubclassOf< AActor > TargetClass, TArray< AActor * > &OutActors)
UFUNCTION(BlueprintCallable, Category = "GameManager|Functionality")
TArray< UInteractiveObjectDataBase * > InteractiveObjectStepDataBase
UPROPERTY()
TArray< FDynamicStoryData > DynamicStoryQueue
UPROPERTY()
void AddNewInteractableObject(ABaseStoryActor *InteractableActor)
UFUNCTION(BlueprintCallable, Category = "GameManager|InteractiveItems")
TArray< FScriptInstanceData > ScriptInstancesData
UPROPERTY(BlueprintReadOnly, Category = "GamaManager|Script")
APixoVRCharacter * PlayerPawnRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
UStoryManager * StoryManagerRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
void PopulateInteractiveObjectsWithStepData(ABaseStoryActor *TargetActor)
UFUNCTION(BlueprintCallable, Category = "GameManager|InteractiveItems")
TArray< ABaseStoryActor * > InteractiveItemsArray
UPROPERTY(BlueprintReadOnly, Category = "GameManager|InteractiveItems")
UStoryScriptClassData * StoryScriptClassData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GameManager|Script")
bool IsUsingStoryScriptData
UPROPERTY(EditDefaultsOnly, Category = "GameManager|Script")
USoundManager * SoundManagerRef
UPROPERTY(BlueprintReadWrite, Category = "GameManager")
void InitializeNewDynamicStory(FDynamicStoryData DynamicStoryData)
UFUNCTION()
void OnNewStoryLoaded(const FText &StepName)
Function for overriding. Called when a new story is loaded.
int ActiveDynamicStoryIndex
UPROPERTY()
void OnGrabbingWrongActor(AActor *WrongActor)
Function for overriding. Called when the wrong interactable actor is grabbed.
TArray< FText > HighlightActiveOnSteps
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
Event called when we on init experience.
Event called when new step is loaded.
Event called when new story is loaded.
TArray< FText > ActiveSteps
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Story|Setup")
bool IsAutoSwitchingToNextStoryActive
UPROPERTY(EditInstanceOnly, Category = "StoryManager|Properties")
bool InitNewStory(int newStoryIndex)
Choose one story from StoryDataArray.
TArray< UStoryData * > StoryDataArray
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool StoryFinished
UPROPERTY(BlueprintReadOnly)
FOnEndOfStory OnEndOfStory
UPROPERTY(BlueprintAssignable, Category = "Story Delegate")
TArray< FScriptClassData > ScriptData
UPROPERTY(EditAnywhere)
UCLASS(BlueprintType, Blueprintable, meta = (ShowWorldContexPin))
void ScriptInitialization()
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Script")
TArray< UStoryData * > DynamicStoryData
UPROPERTY(BlueprintReadWrite)
TArray< UStoryScriptClassData * > StoryScripts
UPROPERTY(BlueprintReadWrite)
TArray< UInteractiveObjectDataBase * > InteractiveObjectData
UPROPERTY(BlueprintReadWrite)
Struct for holding script instance data.
FText StepName
UPROPERTY(BlueprintReadWrite, EditAnywhere)