Rename to Unreal Fighting Framework
This commit is contained in:
parent
891cb89228
commit
e38379586c
@ -1,4 +1,4 @@
|
|||||||
# UnrealFightingEngine
|
# UnrealFightingFramework
|
||||||
|
|
||||||
This library provides actors, components, and other general data structures that are useful for developing character action or fighting games.
|
This library provides actors, components, and other general data structures that are useful for developing character action or fighting games.
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
|
||||||
|
|
||||||
|
|
||||||
#include "IFESystemInterface.h"
|
|
@ -1,8 +0,0 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
|
||||||
|
|
||||||
#include "FEInputBufferComponent.h"
|
|
||||||
|
|
||||||
UFEInputBufferComponent::UFEInputBufferComponent()
|
|
||||||
{
|
|
||||||
PrimaryComponentTick.bCanEverTick = false;
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// UE includes
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "Components/ActorComponent.h"
|
|
||||||
|
|
||||||
#include "FEInputBufferComponent.generated.h"
|
|
||||||
|
|
||||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
|
||||||
class UNREALFIGHTINGENGINE_API UFEInputBufferComponent : public UActorComponent
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
UFEInputBufferComponent();
|
|
||||||
};
|
|
@ -1,20 +0,0 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
|
||||||
|
|
||||||
#include "FEPlayerController.h"
|
|
||||||
|
|
||||||
// FE includes
|
|
||||||
#include "FEInputBufferComponent.h"
|
|
||||||
|
|
||||||
AFEPlayerController::AFEPlayerController()
|
|
||||||
{
|
|
||||||
InputBuffer = CreateDefaultSubobject<UFEInputBufferComponent>(TEXT("InputBuffer"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AFEPlayerController::SendInputsToRemote() const
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void AFEPlayerController::SetupInputComponent()
|
|
||||||
{
|
|
||||||
Super::SetupInputComponent();
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
|
||||||
|
|
||||||
#include "FEState.h"
|
|
||||||
|
|
||||||
// FE includes
|
|
||||||
#include "FEStateMachineComponent.h"
|
|
||||||
|
|
||||||
void UFEState::InitActorInfo(AActor* InOwner, AActor* InAvatar)
|
|
||||||
{
|
|
||||||
Owner = InOwner;
|
|
||||||
Avatar = InAvatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UFEState::Enter()
|
|
||||||
{
|
|
||||||
TicksInState = 0;
|
|
||||||
|
|
||||||
OnEnter();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UFEState::Exit()
|
|
||||||
{
|
|
||||||
OnExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UFEState::Update(float OneFrame)
|
|
||||||
{
|
|
||||||
TicksInState++;
|
|
||||||
|
|
||||||
OnUpdate(OneFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UFEState::OnEnter_Implementation()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UFEState::OnExit_Implementation()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UFEState::OnUpdate_Implementation(float OneFrame)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UWorld* UFEState::GetWorld() const
|
|
||||||
{
|
|
||||||
UFEStateMachineComponent* SMC = Cast<UFEStateMachineComponent>(GetOuter());
|
|
||||||
if(SMC)
|
|
||||||
{
|
|
||||||
return SMC->GetWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
||||||
|
|
||||||
#include "UnrealFightingEngineBPLibrary.h"
|
|
||||||
#include "UnrealFightingEngineModule.h"
|
|
||||||
|
|
||||||
UUnrealFightingEngineBPLibrary::UUnrealFightingEngineBPLibrary(const FObjectInitializer& ObjectInitializer)
|
|
||||||
: Super(ObjectInitializer)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
float UUnrealFightingEngineBPLibrary::UnrealFightingEngineSampleFunction(float Param)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
4
Source/UnrealFightingFramework/IFFSystemInterface.cpp
Normal file
4
Source/UnrealFightingFramework/IFFSystemInterface.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
|
|
||||||
|
#include "IFFSystemInterface.h"
|
@ -1,15 +1,16 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// UE includes
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "UObject/Interface.h"
|
#include "UObject/Interface.h"
|
||||||
|
|
||||||
#include "IFESystemInterface.generated.h"
|
#include "IFFSystemInterface.generated.h"
|
||||||
|
|
||||||
// This class does not need to be modified.
|
// This class does not need to be modified.
|
||||||
UINTERFACE(MinimalAPI)
|
UINTERFACE(MinimalAPI)
|
||||||
class UFESystemInterface : public UInterface
|
class UFFSystemInterface : public UInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
};
|
};
|
||||||
@ -20,7 +21,7 @@ class UFESystemInterface : public UInterface
|
|||||||
* This ensures all gameplay effecting objects can be assumed to have certain properties that enable serialization, networking and
|
* This ensures all gameplay effecting objects can be assumed to have certain properties that enable serialization, networking and
|
||||||
* some form of determinism.
|
* some form of determinism.
|
||||||
*/
|
*/
|
||||||
class UNREALFIGHTINGENGINE_API IFESystemInterface
|
class UNREALFIGHTINGFRAMEWORK_API IFFSystemInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
|
#include "FFInputBufferComponent.h"
|
||||||
|
|
||||||
|
UFFInputBufferComponent::UFFInputBufferComponent()
|
||||||
|
{
|
||||||
|
PrimaryComponentTick.bCanEverTick = false;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// UE includes
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Components/ActorComponent.h"
|
||||||
|
|
||||||
|
#include "FFInputBufferComponent.generated.h"
|
||||||
|
|
||||||
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||||
|
class UNREALFIGHTINGFRAMEWORK_API UFFInputBufferComponent : public UActorComponent
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFFInputBufferComponent();
|
||||||
|
};
|
20
Source/UnrealFightingFramework/Input/FFPlayerController.cpp
Normal file
20
Source/UnrealFightingFramework/Input/FFPlayerController.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
|
#include "FFPlayerController.h"
|
||||||
|
|
||||||
|
// FF includes
|
||||||
|
#include "FFInputBufferComponent.h"
|
||||||
|
|
||||||
|
AFFPlayerController::AFFPlayerController()
|
||||||
|
{
|
||||||
|
InputBuffer = CreateDefaultSubobject<UFFInputBufferComponent>(TEXT("InputBuffer"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AFFPlayerController::SendInputsToRemote() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AFFPlayerController::SetupInputComponent()
|
||||||
|
{
|
||||||
|
Super::SetupInputComponent();
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -6,19 +6,19 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
|
|
||||||
#include "FEPlayerController.generated.h"
|
#include "FFPlayerController.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that collects player inputs, stores them in an input buffer, and sends a rolling window of
|
* A class that collects player inputs, stores them in an input buffer, and sends a rolling window of
|
||||||
* unacknowledged inputs to a remote client or server for processing.
|
* unacknowledged inputs to a remote client or server for processing.
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UNREALFIGHTINGENGINE_API AFEPlayerController : public APlayerController
|
class UNREALFIGHTINGFRAMEWORK_API AFFPlayerController : public APlayerController
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AFEPlayerController();
|
AFFPlayerController();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends all unacknowledged inputs to the remote
|
* Sends all unacknowledged inputs to the remote
|
||||||
@ -31,12 +31,12 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** MappingContext */
|
/** MappingContext */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UFE|Input", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UFF|Input", meta = (AllowPrivateAccess = "true"))
|
||||||
class UInputMappingContext* DefaultMappingContext;
|
class UInputMappingContext* DefaultMappingContext;
|
||||||
|
|
||||||
/** Input Buffer component */
|
/** Input Buffer component */
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "UFE|Input", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "UFF|Input", meta = (AllowPrivateAccess = "true"))
|
||||||
UFEInputBufferComponent* InputBuffer;
|
UFFInputBufferComponent* InputBuffer;
|
||||||
|
|
||||||
int32 Inputs;
|
int32 Inputs;
|
||||||
|
|
61
Source/UnrealFightingFramework/State/FFState.cpp
Normal file
61
Source/UnrealFightingFramework/State/FFState.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
|
#include "FFState.h"
|
||||||
|
|
||||||
|
// FF includes
|
||||||
|
#include "FFStateMachineComponent.h"
|
||||||
|
|
||||||
|
void UFFState::InitActorInfo(AActor* InOwner, AActor* InAvatar)
|
||||||
|
{
|
||||||
|
Owner = InOwner;
|
||||||
|
Avatar = InAvatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UFFState::Enter()
|
||||||
|
{
|
||||||
|
TicksInState = 0;
|
||||||
|
|
||||||
|
OnEnter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UFFState::Exit()
|
||||||
|
{
|
||||||
|
OnExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UFFState::Update(float OneFrame)
|
||||||
|
{
|
||||||
|
TicksInState++;
|
||||||
|
|
||||||
|
OnUpdate(OneFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UFFState::OnEnter_Implementation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UFFState::OnExit_Implementation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UFFState::OnUpdate_Implementation(float OneFrame)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UWorld* UFFState::GetWorld() const
|
||||||
|
{
|
||||||
|
UFFStateMachineComponent* SMC = Cast<UFFStateMachineComponent>(GetOuter());
|
||||||
|
if(SMC)
|
||||||
|
{
|
||||||
|
return SMC->GetWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
@ -1,18 +1,18 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// UE includes
|
// UE includes
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
#include "FEState.generated.h"
|
#include "FFState.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A state is an object that provides rules and conditions for when a state can be transitioned into
|
* 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.
|
* and logic to run when the state is entered, exited, and active.
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UNREALFIGHTINGENGINE_API UFEState : public UObject
|
class UNREALFIGHTINGFRAMEWORK_API UFFState : public UObject
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public:
|
|||||||
virtual void InitActorInfo(AActor* InOwner, AActor* InAvatar);
|
virtual void InitActorInfo(AActor* InOwner, AActor* InAvatar);
|
||||||
|
|
||||||
/** Name of this state */
|
/** Name of this state */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="UFE|State")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="UFF|State")
|
||||||
FName Name;
|
FName Name;
|
||||||
|
|
||||||
/** Conditions that need to be met in order for this state to be transitioned into */
|
/** Conditions that need to be met in order for this state to be transitioned into */
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
uint8 StateType;
|
uint8 StateType;
|
||||||
|
|
||||||
/** How many ticks have elapsed since this state was entered */
|
/** How many ticks have elapsed since this state was entered */
|
||||||
UPROPERTY(BlueprintReadOnly, Category="UFE|State")
|
UPROPERTY(BlueprintReadOnly, Category="UFF|State")
|
||||||
int32 TicksInState;
|
int32 TicksInState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,13 +66,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Blueprint hook that is called whenever this state is transitioned into
|
* Blueprint hook that is called whenever this state is transitioned into
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintNativeEvent, Category="UFE|State|Events")
|
UFUNCTION(BlueprintNativeEvent, Category="UFF|State|Events")
|
||||||
void OnEnter();
|
void OnEnter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blueprint hook that is called whenever this state is transitioned out of into a new state
|
* Blueprint hook that is called whenever this state is transitioned out of into a new state
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintNativeEvent, Category="UFE|State|Events")
|
UFUNCTION(BlueprintNativeEvent, Category="UFF|State|Events")
|
||||||
void OnExit();
|
void OnExit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param OneFrame the time that elapses during one fixed tick
|
* @param OneFrame the time that elapses during one fixed tick
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintNativeEvent, Category="UFE|State|Events")
|
UFUNCTION(BlueprintNativeEvent, Category="UFF|State|Events")
|
||||||
void OnUpdate(float OneFrame);
|
void OnUpdate(float OneFrame);
|
||||||
|
|
||||||
// UObject interface
|
// UObject interface
|
@ -1,22 +1,22 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
#include "FEStateMachineComponent.h"
|
#include "FFStateMachineComponent.h"
|
||||||
|
|
||||||
// FE includes
|
// FF includes
|
||||||
#include "FEState.h"
|
#include "FFState.h"
|
||||||
|
|
||||||
UFEStateMachineComponent::UFEStateMachineComponent()
|
UFFStateMachineComponent::UFFStateMachineComponent()
|
||||||
{
|
{
|
||||||
// Don't use Unreal's tick instead use a fixed tick
|
// Don't use Unreal's tick instead use a fixed tick
|
||||||
PrimaryComponentTick.bCanEverTick = false;
|
PrimaryComponentTick.bCanEverTick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UFEStateMachineComponent::Initialize()
|
void UFFStateMachineComponent::Initialize()
|
||||||
{
|
{
|
||||||
for(const TSubclassOf<UFEState>& CurrState : DefaultStates)
|
for(const TSubclassOf<UFFState>& CurrState : DefaultStates)
|
||||||
{
|
{
|
||||||
UFEState* TempState = AddState(CurrState);
|
UFFState* TempState = AddState(CurrState);
|
||||||
if(!CurrentState) // first state to be created is the entry into this state machine
|
if(!CurrentState) // first state to be created is the entry into this state machine
|
||||||
{
|
{
|
||||||
CurrentState = TempState;
|
CurrentState = TempState;
|
||||||
@ -26,16 +26,16 @@ void UFEStateMachineComponent::Initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UFEStateMachineComponent::InitActorInfo(AActor* InOwner, AActor* InAvatar)
|
void UFFStateMachineComponent::InitActorInfo(AActor* InOwner, AActor* InAvatar)
|
||||||
{
|
{
|
||||||
Owner = InOwner;
|
Owner = InOwner;
|
||||||
Avatar = InAvatar;
|
Avatar = InAvatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UFEState* UFEStateMachineComponent::AddState(TSubclassOf<UFEState> StateClassToAdd)
|
UFFState* UFFStateMachineComponent::AddState(TSubclassOf<UFFState> StateClassToAdd)
|
||||||
{
|
{
|
||||||
UFEState* TempState = NewObject<UFEState>(this, StateClassToAdd);
|
UFFState* TempState = NewObject<UFFState>(this, StateClassToAdd);
|
||||||
if(TempState)
|
if(TempState)
|
||||||
{
|
{
|
||||||
States.Add(TempState);
|
States.Add(TempState);
|
||||||
@ -47,21 +47,21 @@ UFEState* UFEStateMachineComponent::AddState(TSubclassOf<UFEState> StateClassToA
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UFEStateMachineComponent::AddStates(const TArray<TSubclassOf<UFEState>>& StateClassesToAdd)
|
void UFFStateMachineComponent::AddStates(const TArray<TSubclassOf<UFFState>>& StateClassesToAdd)
|
||||||
{
|
{
|
||||||
for(const TSubclassOf<UFEState>& CurrState : StateClassesToAdd)
|
for(const TSubclassOf<UFFState>& CurrState : StateClassesToAdd)
|
||||||
{
|
{
|
||||||
AddState(CurrState);
|
AddState(CurrState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UFEStateMachineComponent::RemoveState(FName StateToRemove)
|
void UFFStateMachineComponent::RemoveState(FName StateToRemove)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Error, TEXT("UFEStateMachineComponent::RemoveState is not yet implemented"));
|
UE_LOG(LogTemp, Error, TEXT("UFFStateMachineComponent::RemoveState is not yet implemented"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UFEStateMachineComponent::SwitchStates(UFEState* NewState)
|
void UFFStateMachineComponent::SwitchStates(UFFState* NewState)
|
||||||
{
|
{
|
||||||
check(NewState);
|
check(NewState);
|
||||||
|
|
||||||
@ -71,15 +71,15 @@ void UFEStateMachineComponent::SwitchStates(UFEState* NewState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FName UFEStateMachineComponent::GetCurrentStateName() const
|
FName UFFStateMachineComponent::GetCurrentStateName() const
|
||||||
{
|
{
|
||||||
return CurrentState ? CurrentState->Name : NAME_None;
|
return CurrentState ? CurrentState->Name : NAME_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UFEState* UFEStateMachineComponent::FindStateWithName(FName StateName)
|
UFFState* UFFStateMachineComponent::FindStateWithName(FName StateName)
|
||||||
{
|
{
|
||||||
for (UFEState* CurrState : States)
|
for (UFFState* CurrState : States)
|
||||||
{
|
{
|
||||||
if(CurrState ->Name == StateName)
|
if(CurrState ->Name == StateName)
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ UFEState* UFEStateMachineComponent::FindStateWithName(FName StateName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UFEStateMachineComponent::BeginPlay()
|
void UFFStateMachineComponent::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
@ -102,11 +102,11 @@ void UFEStateMachineComponent::BeginPlay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UFEStateMachineComponent::FixedTick(float OneFrame)
|
void UFFStateMachineComponent::FixedTick(float OneFrame)
|
||||||
{
|
{
|
||||||
// Should we switch states?
|
// Should we switch states?
|
||||||
|
|
||||||
for(UFEState* CurrState : States)
|
for(UFFState* CurrState : States)
|
||||||
{
|
{
|
||||||
// Check if the state is enabled
|
// Check if the state is enabled
|
||||||
|
|
@ -1,15 +1,15 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// FE includes
|
// FF includes
|
||||||
#include "UnrealFightingEngine/IFESystemInterface.h"
|
#include "UnrealFightingFramework/IFFSystemInterface.h"
|
||||||
|
|
||||||
// UE includes
|
// UE includes
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
|
|
||||||
#include "FEStateMachineComponent.generated.h"
|
#include "FFStateMachineComponent.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A state machine is a component that evaluates and controls the transitions for state objects that
|
* A state machine is a component that evaluates and controls the transitions for state objects that
|
||||||
@ -18,12 +18,12 @@
|
|||||||
* This component also calls the appropriate state logic when a state is changed or the component ticks.
|
* This component also calls the appropriate state logic when a state is changed or the component ticks.
|
||||||
*/
|
*/
|
||||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||||
class UNREALFIGHTINGENGINE_API UFEStateMachineComponent : public UActorComponent, public IFESystemInterface
|
class UNREALFIGHTINGFRAMEWORK_API UFFStateMachineComponent : public UActorComponent, public IFFSystemInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFEStateMachineComponent();
|
UFFStateMachineComponent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and adds default states and enters the first state
|
* Creates and adds default states and enters the first state
|
||||||
@ -47,14 +47,14 @@ public:
|
|||||||
*
|
*
|
||||||
* @return A pointer to the state that was added or nullptr if there was an issue adding or creating the state
|
* @return A pointer to the state that was added or nullptr if there was an issue adding or creating the state
|
||||||
*/
|
*/
|
||||||
UFEState* AddState(TSubclassOf<UFEState> StateClassToAdd);
|
UFFState* AddState(TSubclassOf<UFFState> StateClassToAdd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an instance of the state classes and adds newly created states to this state machine.
|
* Creates an instance of the state classes and adds newly created states to this state machine.
|
||||||
*
|
*
|
||||||
* @param StateClassesToAdd Array of state class types to be added to this state machine
|
* @param StateClassesToAdd Array of state class types to be added to this state machine
|
||||||
*/
|
*/
|
||||||
void AddStates(const TArray<TSubclassOf<UFEState>>& StateClassesToAdd);
|
void AddStates(const TArray<TSubclassOf<UFFState>>& StateClassesToAdd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the state with corresponding name and removes it from this state machine.
|
* Destroys the state with corresponding name and removes it from this state machine.
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Triggers the Exit callback on the CurrentState and the Enter callback on the new state
|
* Triggers the Exit callback on the CurrentState and the Enter callback on the new state
|
||||||
*/
|
*/
|
||||||
void SwitchStates(UFEState* NewState);
|
void SwitchStates(UFFState* NewState);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the current state
|
* Returns the name of the current state
|
||||||
@ -74,9 +74,9 @@ public:
|
|||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
FName GetCurrentStateName() const;
|
FName GetCurrentStateName() const;
|
||||||
|
|
||||||
// IFESystemInterface interface
|
// IFFSystemInterface interface
|
||||||
virtual void FixedTick(float OneFrame) override;
|
virtual void FixedTick(float OneFrame) override;
|
||||||
// End of IFESystemInterface interface
|
// End of IFFSystemInterface interface
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -96,21 +96,21 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* States classes to create and add to this state machine when the game starts
|
* States classes to create and add to this state machine when the game starts
|
||||||
*/
|
*/
|
||||||
UPROPERTY(EditDefaultsOnly, Category="UFE|State Machine")
|
UPROPERTY(EditDefaultsOnly, Category="UFF|State Machine")
|
||||||
TArray<TSubclassOf<UFEState>> DefaultStates;
|
TArray<TSubclassOf<UFFState>> DefaultStates;
|
||||||
|
|
||||||
/** Current active state for this state machine */
|
/** Current active state for this state machine */
|
||||||
UPROPERTY(BlueprintReadOnly)
|
UPROPERTY(BlueprintReadOnly)
|
||||||
UFEState* CurrentState;
|
UFFState* CurrentState;
|
||||||
|
|
||||||
// States that have been added
|
// States that have been added
|
||||||
UPROPERTY(BlueprintReadOnly)
|
UPROPERTY(BlueprintReadOnly)
|
||||||
TArray<UFEState*> States;
|
TArray<UFFState*> States;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the state with corresponding name
|
* Returns the state with corresponding name
|
||||||
*/
|
*/
|
||||||
UFEState* FindStateWithName(FName StateName);
|
UFFState* FindStateWithName(FName StateName);
|
||||||
|
|
||||||
// UActorComponent interface
|
// UActorComponent interface
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
@ -1,10 +1,10 @@
|
|||||||
// Unreal Fighting Engine by Kevin Poretti
|
// Unreal Fighting Framework by Kevin Poretti
|
||||||
|
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
|
|
||||||
public class UnrealFightingEngine : ModuleRules
|
public class UnrealFightingFramework : ModuleRules
|
||||||
{
|
{
|
||||||
public UnrealFightingEngine(ReadOnlyTargetRules Target) : base(Target)
|
public UnrealFightingFramework(ReadOnlyTargetRules Target) : base(Target)
|
||||||
{
|
{
|
||||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "UnrealFightingFrameworkBPLibrary.h"
|
||||||
|
#include "UnrealFightingFrameworkModule.h"
|
||||||
|
|
||||||
|
UUnrealFightingFrameworkBPLibrary::UUnrealFightingFrameworkBPLibrary(const FObjectInitializer& ObjectInitializer)
|
||||||
|
: Super(ObjectInitializer)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float UUnrealFightingFrameworkBPLibrary::UnrealFightingFrameworkSampleFunction(float Param)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||||
#include "UnrealFightingEngineBPLibrary.generated.h"
|
#include "UnrealFightingFrameworkBPLibrary.generated.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function library class.
|
* Function library class.
|
||||||
@ -23,10 +23,10 @@
|
|||||||
* https://wiki.unrealengine.com/Custom_Blueprint_Node_Creation
|
* https://wiki.unrealengine.com/Custom_Blueprint_Node_Creation
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UUnrealFightingEngineBPLibrary : public UBlueprintFunctionLibrary
|
class UUnrealFightingFrameworkBPLibrary : public UBlueprintFunctionLibrary
|
||||||
{
|
{
|
||||||
GENERATED_UCLASS_BODY()
|
GENERATED_UCLASS_BODY()
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Execute Sample function", Keywords = "UnrealFightingEngine sample test testing"), Category = "UnrealFightingEngineTesting")
|
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Execute Sample function", Keywords = "UnrealFightingFramework sample test testing"), Category = "UnrealFightingFrameworkTesting")
|
||||||
static float UnrealFightingEngineSampleFunction(float Param);
|
static float UnrealFightingFrameworkSampleFunction(float Param);
|
||||||
};
|
};
|
@ -1,16 +1,16 @@
|
|||||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "UnrealFightingEngineModule.h"
|
#include "UnrealFightingFrameworkModule.h"
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "FUnrealFightingEngineModule"
|
#define LOCTEXT_NAMESPACE "FUnrealFightingFrameworkModule"
|
||||||
|
|
||||||
void FUnrealFightingEngineModule::StartupModule()
|
void FUnrealFightingFrameworkModule::StartupModule()
|
||||||
{
|
{
|
||||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FUnrealFightingEngineModule::ShutdownModule()
|
void FUnrealFightingFrameworkModule::ShutdownModule()
|
||||||
{
|
{
|
||||||
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
||||||
// we call this function before unloading the module.
|
// we call this function before unloading the module.
|
||||||
@ -19,4 +19,4 @@ void FUnrealFightingEngineModule::ShutdownModule()
|
|||||||
|
|
||||||
#undef LOCTEXT_NAMESPACE
|
#undef LOCTEXT_NAMESPACE
|
||||||
|
|
||||||
IMPLEMENT_MODULE(FUnrealFightingEngineModule, UnrealFightingEngine)
|
IMPLEMENT_MODULE(FUnrealFightingFrameworkModule, UnrealFightingFramework)
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "Modules/ModuleManager.h"
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
class FUnrealFightingEngineModule : public IModuleInterface
|
class FUnrealFightingFrameworkModule : public IModuleInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
"FileVersion": 3,
|
"FileVersion": 3,
|
||||||
"Version": 1,
|
"Version": 1,
|
||||||
"VersionName": "1.0",
|
"VersionName": "1.0",
|
||||||
"FriendlyName": "UnrealFightingEngine",
|
"FriendlyName": "UnrealFightingFramework",
|
||||||
"Description": "This library provides actors, components, and other general data structures that are useful for developing character action or fighting games.",
|
"Description": "This library provides actors, components, and other general data structures that are useful for developing character action or fighting games.",
|
||||||
"Category": "Other",
|
"Category": "Other",
|
||||||
"CreatedBy": "Kevin Poretti",
|
"CreatedBy": "Kevin Poretti",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"Installed": false,
|
"Installed": false,
|
||||||
"Modules": [
|
"Modules": [
|
||||||
{
|
{
|
||||||
"Name": "UnrealFightingEngine",
|
"Name": "UnrealFightingFramework",
|
||||||
"Type": "Runtime",
|
"Type": "Runtime",
|
||||||
"LoadingPhase": "PreLoadingScreen"
|
"LoadingPhase": "PreLoadingScreen"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user