Fix one dollar recognizer implementation
This commit is contained in:
@@ -3,18 +3,19 @@
|
||||
|
||||
#include "LumiCharacter.h"
|
||||
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "Engine/UserInterfaceSettings.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "GameFramework/Controller.h"
|
||||
#include "InputActionValue.h"
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "Engine/UserInterfaceSettings.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "GameFramework/Controller.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "InputActionValue.h"
|
||||
#include "WizardingCentral/Logger/LogLumiCharacter.h"
|
||||
#include "WizardingCentral/Utils/OneDollar/UniStrokeDataTable.h"
|
||||
#include "WizardingCentral/Utils/OneDollar/UniStrokeResult.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY(LogLumiCharacter);
|
||||
static const FString SpellTemplatesTablePath = TEXT("/Game/DataTables/SpellTemplates.SpellTemplates");
|
||||
|
||||
// Sets default values
|
||||
ALumiCharacter::ALumiCharacter()
|
||||
@@ -49,8 +50,17 @@ ALumiCharacter::ALumiCharacter()
|
||||
// Spell System
|
||||
bIsDrawing = false;
|
||||
SpellRecognizer = new FUniStrokeRecognizer();
|
||||
if (SpellTemplatesTable)
|
||||
LoadSpellTemplates();
|
||||
if (SpellTemplatesTable == nullptr)
|
||||
{
|
||||
SpellTemplatesTable = Cast<UDataTable>(
|
||||
StaticLoadObject(
|
||||
UDataTable::StaticClass(),
|
||||
nullptr,
|
||||
*SpellTemplatesTablePath
|
||||
)
|
||||
);
|
||||
}
|
||||
LoadSpellTemplates();
|
||||
}
|
||||
|
||||
ELumiStance ALumiCharacter::GetCurrentStance() const
|
||||
@@ -123,7 +133,9 @@ void ALumiCharacter::OnJumpActionStarted(const FInputActionValue& Value)
|
||||
Jump();
|
||||
}
|
||||
|
||||
void ALumiCharacter::OnJumpActionOngoing(const FInputActionValue& Value) {}
|
||||
void ALumiCharacter::OnJumpActionOngoing(const FInputActionValue& Value)
|
||||
{
|
||||
}
|
||||
|
||||
void ALumiCharacter::OnJumpActionCompleted(const FInputActionValue& Value)
|
||||
{
|
||||
@@ -300,7 +312,7 @@ void ALumiCharacter::LoadSpellTemplates() const
|
||||
void ALumiCharacter::CastSpell()
|
||||
{
|
||||
const TArray<FVector2D>* CurrentPoints = SpellOverlay->GetSpellPoints();
|
||||
const FUniStrokeResult Result = SpellRecognizer->Recognize(*CurrentPoints, false);
|
||||
const FUniStrokeResult Result = SpellRecognizer->Recognize(*CurrentPoints);
|
||||
|
||||
bool bHasMatch = false;
|
||||
if (Result.Score < 0.8f)
|
||||
|
||||
@@ -15,8 +15,6 @@ class USpringArmComponent;
|
||||
class UCameraComponent;
|
||||
struct FInputActionValue;
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogLumiCharacter, Log, All);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FJumpDelegate);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FStanceChangedDelegate,
|
||||
@@ -145,13 +143,24 @@ public:
|
||||
OnSpellActionCompleted();
|
||||
void
|
||||
OnSpellPositionActionTriggered(const FInputActionValue& Value);
|
||||
void
|
||||
OnSpellTrainSwitchActionCompleted();
|
||||
|
||||
void OnSpellTrainSwitchActionCompleted();
|
||||
UFUNCTION(BlueprintCallable, Category = "Spell")
|
||||
void
|
||||
SetIsTraining(const bool bTraining);
|
||||
|
||||
void SetIsTraining(const bool bTraining);
|
||||
void HideTrainWidget();
|
||||
void ShowTrainWidget();
|
||||
void AddSpellTemplateToTable(const FString& Name);
|
||||
UFUNCTION(BlueprintCallable, Category = "Spell")
|
||||
void
|
||||
HideTrainWidget();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Spell")
|
||||
void
|
||||
ShowTrainWidget();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Spell")
|
||||
void
|
||||
AddSpellTemplateToTable(const FString& Name);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,11 @@ void ALumiController::GetLumiCharacter(ALumiCharacter*& OutLumiCharacter) const
|
||||
OutLumiCharacter = LumiCharacter;
|
||||
}
|
||||
|
||||
ALumiCharacter* ALumiController::GetLumiCharacter() const
|
||||
{
|
||||
return LumiCharacter;
|
||||
}
|
||||
|
||||
void ALumiController::OnPossess(APawn* InPawn)
|
||||
{
|
||||
Super::OnPossess(InPawn);
|
||||
@@ -99,8 +104,8 @@ void ALumiController::OnPossess(APawn* InPawn)
|
||||
{
|
||||
EnhancedInputComponent->BindAction(SpellAction,
|
||||
ETriggerEvent::Started,
|
||||
LumiCharacter,
|
||||
&ALumiCharacter::OnSpellActionStarted);
|
||||
this,
|
||||
&ALumiController::OnSpellActionStarted);
|
||||
EnhancedInputComponent->BindAction(SpellAction,
|
||||
ETriggerEvent::Completed,
|
||||
this,
|
||||
@@ -128,12 +133,12 @@ void ALumiController::OnUnPossess()
|
||||
|
||||
void ALumiController::OnSpellActionStarted()
|
||||
{
|
||||
ShowMouseCursor();
|
||||
// ShowMouseCursor();
|
||||
LumiCharacter->OnSpellActionStarted();
|
||||
}
|
||||
|
||||
void ALumiController::OnSpellActionCompleted()
|
||||
{
|
||||
LumiCharacter->OnSpellActionCompleted();
|
||||
HideMouseCursor();
|
||||
// HideMouseCursor();
|
||||
}
|
||||
|
||||
@@ -60,6 +60,10 @@ public:
|
||||
void
|
||||
GetLumiCharacter(ALumiCharacter*& OutLumiCharacter) const;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "LumiController")
|
||||
ALumiCharacter*
|
||||
GetLumiCharacter() const;
|
||||
|
||||
protected:
|
||||
virtual void
|
||||
OnPossess(APawn* InPawn) override;
|
||||
|
||||
Reference in New Issue
Block a user