106 lines
2.7 KiB
C++
106 lines
2.7 KiB
C++
// Unreal Fighting Engine by Kevin Poretti
|
|
|
|
#pragma once
|
|
|
|
// UE includes
|
|
#include "CoreMinimal.h"
|
|
|
|
#include "FEState.generated.h"
|
|
|
|
/**
|
|
* A state is an object that provides rules and conditions for when a state can be transitioned into
|
|
* and logic to run when the state is entered, exited, and active.
|
|
*/
|
|
UCLASS()
|
|
class UNREALFIGHTINGENGINE_API UFEState : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
/**
|
|
* Initializes pointers to what owns this state and what avatar this state represents.
|
|
*
|
|
* @param InOwner Actor that owns this state machine.
|
|
* @param InAvatar Actor that this state machine represents.
|
|
*/
|
|
virtual void InitActorInfo(AActor* InOwner, AActor* InAvatar);
|
|
|
|
/** Name of this state */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="UFE|State")
|
|
FName Name;
|
|
|
|
/** Conditions that need to be met in order for this state to be transitioned into */
|
|
UPROPERTY(EditAnywhere)
|
|
TArray<uint8> EntryConditions;
|
|
|
|
/** What is this state's category. Used for determining what types of state can prematurely cancel this one. */
|
|
UPROPERTY(EditAnywhere)
|
|
uint8 StateType;
|
|
|
|
/** How many ticks have elapsed since this state was entered */
|
|
UPROPERTY(BlueprintReadOnly, Category="UFE|State")
|
|
int32 TicksInState;
|
|
|
|
/**
|
|
* Called whenever this state is transitioned into.
|
|
*
|
|
* Resets TicksInState and calls appropriate Blueprint hooks
|
|
*/
|
|
void Enter();
|
|
|
|
/**
|
|
* Called whenever this state is transitioned out of into a new state.
|
|
*/
|
|
void Exit();
|
|
|
|
/**
|
|
* Called whenever this state is active and the game logic ticks.
|
|
*
|
|
* Increments TicksInState and calls appropriate Blueprint hooks.
|
|
*
|
|
* @param OneFrame the time that elapses during one fixed tick
|
|
*/
|
|
void FixedTick(float OneFrame);
|
|
|
|
/**
|
|
* Blueprint hook that is called whenever this state is transitioned into
|
|
*/
|
|
UFUNCTION(BlueprintNativeEvent, Category="UFE|State|Events")
|
|
void OnEnter();
|
|
|
|
/**
|
|
* Blueprint hook that is called whenever this state is transitioned out of into a new state
|
|
*/
|
|
UFUNCTION(BlueprintNativeEvent, Category="UFE|State|Events")
|
|
void OnExit();
|
|
|
|
/**
|
|
* Blueprint hook that is called whenever this state is active and the game logic ticks
|
|
*
|
|
* @param OneFrame the time that elapses during one fixed tick
|
|
*/
|
|
UFUNCTION(BlueprintNativeEvent, Category="UFE|State|Events")
|
|
void OnFixedTick(float OneFrame);
|
|
|
|
// UObject interface
|
|
virtual UWorld* GetWorld() const override;
|
|
// End of UObject interface
|
|
|
|
protected:
|
|
|
|
/**
|
|
* Actor that owns this state.
|
|
* This will typically be a player controller that possesses the avatar.
|
|
*/
|
|
UPROPERTY(BlueprintReadOnly)
|
|
AActor* Owner;
|
|
|
|
/**
|
|
* The avatar is an actor that this state represents.
|
|
* This will typically be a pawn or character.
|
|
*/
|
|
UPROPERTY(BlueprintReadOnly)
|
|
AActor* Avatar;
|
|
};
|