ArticyXImporter
ArticyXImporter for Unreal Engine
Loading...
Searching...
No Matches
UArticyFlowPlayer Class Reference

#include <ArticyFlowPlayer.h>

Inheritance diagram for UArticyFlowPlayer:

Public Member Functions

void BeginPlay () override
void EndPlay (const EEndPlayReason::Type EndPlayReason) override
template<typename Lambda>
void ShadowedOperation (Lambda Operation) const
uint32 GetShadowLevel () const
 UFUNCTION (BlueprintCallable, meta=(DisplayName="Set Start Node (ArticyRef)"), Category="Setup") void SetStartNode(FArticyRef NewId)
 UFUNCTION (BlueprintCallable, meta=(DisplayName="Set Start Node (ArticyID)"), Category="Setup") void SetStartNodeById(FArticyId NewId)
 UFUNCTION (BlueprintCallable, meta=(DisplayName="Set Start Node (FlowObject)"), Category="Setup") void SetStartNodeWithFlowObject(TScriptInterface< IArticyFlowObject > Node)
FArticyRef GetStartNode ()
void SetIgnoreInvalidBranches (bool bNewIgnoreInvalidBranches)
void SetCursorTo (TScriptInterface< IArticyFlowObject > Node)
const TScriptInterface< IArticyFlowObjectGetCursor () const
void Play (int Index=0)
void FinishCurrentPausedObject (int PinIndex=0)
void PlayBranch (const FArticyBranch &Branch)
TArray< FArticyBranchExplore (IArticyFlowObject *Node, bool bShadowed, int32 Depth, bool IncludeCurrent=true)
void SetPauseOn (EArticyPausableType Types)
bool ShouldPauseOn (IArticyFlowObject *Node) const
bool ShouldPauseOn (TScriptInterface< IArticyFlowObject > Node) const
UArticyGlobalVariablesGetGVs () const
UObject * GetMethodsProvider ()
void UpdateAvailableBranches ()
const TArray< FArticyBranch > & GetAvailableBranches () const
bool IgnoresInvalidBranches () const
bool OnTick (float DeltaTime)
 DECLARE_DYNAMIC_MULTICAST_DELEGATE (FOnPushState)
 DECLARE_DYNAMIC_MULTICAST_DELEGATE (FOnPopState)
 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FOnPlayerPaused, TScriptInterface< IArticyFlowObject >, PausedOn)
 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FOnBranchesUpdated, const TArray< FArticyBranch > &, AvailableBranches)

Public Attributes

uint8 PauseOn
FOnPushState OnShadowOpStart
FOnPopState OnShadowOpEnd
FOnPlayerPaused OnPlayerPaused
FOnBranchesUpdated OnBranchesUpdated

Protected Attributes

int32 ExploreLimit = 128
uint8 ShadowLevelLimit = 10
bool bIgnoreInvalidBranches = true
FArticyRef StartOn
TArray< FArticyBranchAvailableBranches
TFunction< bool(const FArticyBranch &, const FArticyBranch &)> SortBranches = ArticyBranchSorters::FArticyBranchPositionSorter()
UArticyAlternativeGlobalVariablesOverrideGV = nullptr
UObject * UserMethodsProvider

Detailed Description

This component handles traversal of the flow, starting and halting at specific nodes. The GlobalVariables instance and the UserMethodProvider used for this flow player instance can be specified.

Member Function Documentation

◆ BeginPlay()

void UArticyFlowPlayer::BeginPlay ( )
override

Called when the game starts or when spawned.

◆ EndPlay()

void UArticyFlowPlayer::EndPlay ( const EEndPlayReason::Type EndPlayReason)
override

Called when the game ends or actor destroyed

◆ Explore()

TArray< FArticyBranch > UArticyFlowPlayer::Explore ( IArticyFlowObject * Node,
bool bShadowed,
int32 Depth,
bool IncludeCurrent = true )

Gather all branches that start from this node. The explore can be performed as shadowed operation. If the node is submergeable, a submerge is performed.

Explores the flow starting from a specified node.

Parameters
NodeThe node to start exploring from.
bShadowedWhether the exploration should be shadowed.
DepthThe current depth of exploration.
IncludeCurrentWhether to include the current node in the exploration.
Returns
An array of branches resulting from the exploration.

◆ FinishCurrentPausedObject()

void UArticyFlowPlayer::FinishCurrentPausedObject ( int PinIndex = 0)

Calls the script on an output pin of the current object

Finishes the current paused object by executing a specified pin.

Parameters
PinIndexThe index of the pin to execute.

◆ GetAvailableBranches()

const TArray< FArticyBranch > & UArticyFlowPlayer::GetAvailableBranches ( ) const
inline

Get the currently available branches. This does not re-explore the branches.

◆ GetCursor()

const TScriptInterface< IArticyFlowObject > UArticyFlowPlayer::GetCursor ( ) const
inline

Get the Cursor (current node).

◆ GetGVs()

UArticyGlobalVariables * UArticyFlowPlayer::GetGVs ( ) const

Get the GV instance used for expresso script execution.

Retrieves the global variables used by this flow player.

Returns
A pointer to the UArticyGlobalVariables instance.

◆ GetMethodsProvider()

UObject * UArticyFlowPlayer::GetMethodsProvider ( )

Get the UserMethodsProvider used for resolving user defined methods.

Retrieves the user methods provider for this flow player.

Returns
A pointer to the methods provider object.

◆ GetStartNode()

FArticyRef UArticyFlowPlayer::GetStartNode ( )
inline

Gets the last set StartOn node

◆ IgnoresInvalidBranches()

bool UArticyFlowPlayer::IgnoresInvalidBranches ( ) const
inline

Wether bIgnoreInvalidBranches is set.

◆ Play()

void UArticyFlowPlayer::Play ( int BranchIndex = 0)

Play a branch, identified by its index in the AvailableBranches array.

Plays a specified branch by index.

Parameters
BranchIndexThe index of the branch to play.

◆ PlayBranch()

void UArticyFlowPlayer::PlayBranch ( const FArticyBranch & Branch)

Traverse this branch to the end, executing all scripts and updating the Cursor to the branche's target.

Plays a specified branch, executing all nodes within it.

Parameters
BranchThe branch to play.

◆ SetCursorTo()

void UArticyFlowPlayer::SetCursorTo ( TScriptInterface< IArticyFlowObject > Node)

Set the Cursor (current node) to this Node and updates the available branches.

Sets the cursor to a specified node.

Parameters
NodeThe flow object to which the cursor should be set.

◆ SetIgnoreInvalidBranches()

void UArticyFlowPlayer::SetIgnoreInvalidBranches ( bool bNewIgnoreInvalidBranches)
inline

Gets the last set StartOn node

◆ SetPauseOn()

void UArticyFlowPlayer::SetPauseOn ( EArticyPausableType Types)

Sets the nodes on which the flow player should pause.

Parameters
TypesThe types of nodes to pause on.

◆ ShadowedOperation()

template<typename Lambda>
void UArticyFlowPlayer::ShadowedOperation ( Lambda Operation) const

Pushes a shadow state, executes the operation, then pops the shadow state back. The method is 'const' to eliminate side-effects (except for ShadowLevel).

Executes a lambda function within a shadowed operation.

Template Parameters
LambdaThe lambda function type.
Parameters
OperationThe lambda function to execute.

◆ ShouldPauseOn() [1/2]

bool UArticyFlowPlayer::ShouldPauseOn ( IArticyFlowObject * Node) const

Returns true if Node is one of the PauseOn types.

Determines whether the flow player should pause on a specific node.

Parameters
NodeThe node to check.
Returns
True if the flow player should pause on the node, otherwise false.

◆ ShouldPauseOn() [2/2]

bool UArticyFlowPlayer::ShouldPauseOn ( TScriptInterface< IArticyFlowObject > Node) const

Determines whether the flow player should pause on a specific node.

Parameters
NodeThe node to check.
Returns
True if the flow player should pause on the node, otherwise false.

◆ UFUNCTION() [1/2]

UArticyFlowPlayer::UFUNCTION ( BlueprintCallable ,
meta = (DisplayName="Set Start Node (ArticyRef)"),
Category = "Setup" )

Set the StartOn node to a certain node.

◆ UFUNCTION() [2/2]

UArticyFlowPlayer::UFUNCTION ( BlueprintCallable ,
meta = (DisplayName="Set Start Node (FlowObject)"),
Category = "Setup" )

Set the StartOn node to a certain node.

◆ UpdateAvailableBranches()

void UArticyFlowPlayer::UpdateAvailableBranches ( )

Explore branches starting from the current StartOn node.

Updates the available branches from the current cursor position.

Member Data Documentation

◆ AvailableBranches

TArray<FArticyBranch> UArticyFlowPlayer::AvailableBranches
protected

All the branches available at the current flow position.

◆ bIgnoreInvalidBranches

bool UArticyFlowPlayer::bIgnoreInvalidBranches = true
protected

Invalid branches will not be part of the AvailableBranches.

◆ ExploreLimit

int32 UArticyFlowPlayer::ExploreLimit = 128
protected

If this number of branches is reached, no more branches will be added. If a branch reaches this length, exploration on it is aborted.

◆ OnBranchesUpdated

FOnBranchesUpdated UArticyFlowPlayer::OnBranchesUpdated

This delegate is called when the AvailableBranches change.

◆ OnPlayerPaused

FOnPlayerPaused UArticyFlowPlayer::OnPlayerPaused

This delegate is called when the flow player pauses on one of the object types set up in "PauseOn", or if the branch is done.

◆ OnShadowOpEnd

FOnPopState UArticyFlowPlayer::OnShadowOpEnd

This event is broadcast once the current ShadowedOperation ends.

◆ OnShadowOpStart

FOnPushState UArticyFlowPlayer::OnShadowOpStart

This event is broadcast whenever a new ShadowedOperation starts.

◆ OverrideGV

UArticyAlternativeGlobalVariables* UArticyFlowPlayer::OverrideGV = nullptr
protected

The instance of the global variables to be used with this flow player instance. This property is private so it can only be directly changed through the editor, so we can ensure that the needed setup is triggered every time this changes.

Keep as nullptr if you want to use the default shared global variables.

◆ PauseOn

uint8 UArticyFlowPlayer::PauseOn
Initial value:
= 1 << uint8(EArticyPausableType::DialogueFragment)
| 1 << uint8(EArticyPausableType::Dialogue)
| 1 << uint8(EArticyPausableType::FlowFragment)

◆ ShadowLevelLimit

uint8 UArticyFlowPlayer::ShadowLevelLimit = 10
protected

If more than this amount of ShadowLevels are needed at the same time, branch exploration will abort.

◆ SortBranches

TFunction<bool(const FArticyBranch&, const FArticyBranch&)> UArticyFlowPlayer::SortBranches = ArticyBranchSorters::FArticyBranchPositionSorter()
protected

The function to use to sort branches after determining the available branches. Defaults to sorting by position.

◆ UserMethodsProvider

UObject* UArticyFlowPlayer::UserMethodsProvider
mutableprotected

This object will be used to resolve user-defined ScriptMethods. It must implement the project-specific I<ProjectName>MethodsProvider interface (through blueprint or through inheritance). This property is private so it can only be directly changed through the editor, so we can ensure that the needed setup is triggered every time this changes.


The documentation for this class was generated from the following files:
  • Source/ArticyRuntime/Public/ArticyFlowPlayer.h
  • Source/ArticyRuntime/Private/ArticyFlowPlayer.cpp