main
wy 2026-01-16 21:34:51 +09:00
commit c99be9e314
362 changed files with 30208 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# ProjectM

View File

@ -0,0 +1,71 @@
// Fill out your copyright notice in the Description page of Project Settings.
#if WITH_EDITOR
#include "CustomExtensionCommands.h"
//Uncomment if you are necessary
//#include "Misc/MessageDialog.h"
//#include "LevelEditor.h"
//#include "Engine/Selection.h"
//#include "Editor/EditorEngine.h"
#include "Editor/Blutility/Classes/EditorUtilityWidget.h"
#include "EditorUtilitySubsystem.h"
#include "EditorUtilityWidgetBlueprint.h"
//#include "Misc/FileHelper.h"
//#include "HAL/FileManagerGeneric.h"
//#include "NotificationHelper.h"
#define LOCTEXT_NAMESPACE "IGCCommand"
void CustomExtensionCommands::RegisterCommands()
{
UI_COMMAND(Command1, "LevelTool", "Button1", EUserInterfaceActionType::Button, FInputGesture());
UI_COMMAND(Command2, "IGCCommand2", "Button2", EUserInterfaceActionType::Button, FInputGesture());
UI_COMMAND(Command3, "IGCCommand3", "Button3", EUserInterfaceActionType::Button, FInputGesture());
}
void FIGCExtensionActions::Action1()
{
UEditorUtilityWidgetBlueprint* LevelToolWBPU = LoadObject<UEditorUtilityWidgetBlueprint>(nullptr, L"/Game/System/Core/Blutilities/WBPU_LevelToolByTable");
UWorld* World = GEditor->GetEditorWorldContext().World();
if(World)
{
if(UEditorUtilitySubsystem* EditorUtilitySubsystem = GEditor->GetEditorSubsystem<UEditorUtilitySubsystem>())
{
if(LevelToolWBPU != nullptr)
{
EditorUtilitySubsystem->SpawnAndRegisterTab(LevelToolWBPU);
}
}
}
}
void FIGCExtensionActions::Action2()
{
/*Active Action when Press Button2*/
}
void FIGCExtensionActions::Action3()
{
/*Active Action when Press Button3*/
}
void FIGCExtensionActions::Action4(ECheckBoxState state)
{
/*Active Action when Checking to CheckBox1*/
}
void FIGCExtensionActions::Action5(ECheckBoxState state)
{
/*Active Action when Checking to CheckBox2*/
}
void FIGCExtensionActions::Action6(TSharedPtr<FString> NewSelection)
{
/*Active Action when Selecting to ComboBox's value */
}
#endif

View File

@ -0,0 +1,53 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#if WITH_EDITOR
#include "CoreMinimal.h"
#include "Framework/Commands/Commands.h"
#include "../EditorSlateStyle/CustomSlateStyle.h"
/**
*
*/
class EDITORUTILITYMODULE_API CustomExtensionCommands : public TCommands<CustomExtensionCommands>
{
public:
CustomExtensionCommands()
:TCommands<CustomExtensionCommands>(TEXT("CustomExtensionCommands"), NSLOCTEXT("CustomExtensionCommands", "CustomExtensionCommands", "CustomExtensionCommands"), NAME_None, CustomSlateStyle::GetStyleSetName())
{
}
virtual void RegisterCommands()override;
public:
//Slate button commands
TSharedPtr< FUICommandInfo > Command1;
TSharedPtr< FUICommandInfo > Command2;
TSharedPtr< FUICommandInfo > Command3;
};
/*Actions by Slate UI*/
class FIGCExtensionActions
{
public:
static void Action1();
static void Action2();
static void Action3();
static void Action4(ECheckBoxState state);
static void Action5(ECheckBoxState state);
static void Action6(TSharedPtr<FString> NewSelection);
};
#endif

View File

@ -0,0 +1,58 @@
// Fill out your copyright notice in the Description page of Project Settings.
#if WITH_EDITOR
#include "CustomSlateStyle.h"
#include "Slate/SlateGameResources.h"
#include "Styling/SlateStyleRegistry.h"
TSharedPtr< FSlateStyleSet > CustomSlateStyle::StyleInstance = nullptr;
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
const FVector2D Icon16x16(16.0f, 16.0f);
const FVector2D Icon20x20(20.0f, 20.0f);
const FVector2D Icon40x40(40.0f, 40.0f);
const FVector2D DebugToolBtn(64.f, 64.f);
void CustomSlateStyle::Initialize()
{
if(!StyleInstance.IsValid())
{
// StyleInstance = Create();
// FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance);
}
}
void CustomSlateStyle::Shutdown()
{
// FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance);
// ensure(StyleInstance.IsUnique());
// StyleInstance.Reset();
}
const ISlateStyle& CustomSlateStyle::Get()
{
return *StyleInstance;
}
FName CustomSlateStyle::GetStyleSetName()
{
static FName StyleSetName(TEXT("IGCExtensionStyle"));
return StyleSetName;
}
//TSharedRef<class FSlateStyleSet> CustomSlateStyle::Create()
//{
// TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("IGCExtensionStyle"));
//
// /*Style->SetContentRoot(FPaths::EngineContentDir() / TEXT("Editor/Slate"));
// Style->Set("IGCToolbarIcon.Command2", new IMAGE_BRUSH("Old/Kismet2/compile_512px", DebugToolBtn));
// Style->Set("IGCToolbarIcon.Command3", new IMAGE_BRUSH("Old/TrashCan", DebugToolBtn));*/
//
// return Style;
//}
#undef IMAGE_BRUSH
#endif

View File

@ -0,0 +1,30 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#if WITH_EDITOR
#include "CoreMinimal.h"
/**
*
*/
class EDITORUTILITYMODULE_API CustomSlateStyle
{
public:
static void Initialize();
static void Shutdown();
static const ISlateStyle& Get();
static FName GetStyleSetName();
private:
// static TSharedRef< class FSlateStyleSet > Create();
private:
static TSharedPtr< class FSlateStyleSet > StyleInstance;
};
#endif

View File

@ -0,0 +1,21 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class EditorUtilityModule : ModuleRules
{
public EditorUtilityModule(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Slate", "SlateCore" });
if (Target.Type == TargetRules.TargetType.Editor)
{
PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd", "LevelEditor" });
PrivateDependencyModuleNames.AddRange(new string[] { "UMG", "Blutility", "UMGEditor" });
}
}
}

View File

@ -0,0 +1,132 @@

#if WITH_EDITOR
#include "EditorUtilityModule.h"
#include "Commands/CustomExtensionCommands.h"
#include "Framework/MultiBox/MultiBoxExtender.h"
#include "Framework/MultiBox/MultiBoxBuilder.h"
#include "LevelEditor.h"
IMPLEMENT_MODULE(FEditorUtilityModule, EditorUtilityModule);
#define LOCTEXT_NAMESPACE "IGCMenu"
void FEditorUtilityModule::StartupModule()
{
CustomSlateStyle::Initialize();
CustomExtensionCommands::Register();
IGCCommandList = MakeShareable(new FUICommandList());
IGCCommandList->MapAction(CustomExtensionCommands::Get().Command1, FExecuteAction::CreateStatic(&FIGCExtensionActions::Action1), FCanExecuteAction());
IGCCommandList->MapAction(CustomExtensionCommands::Get().Command2, FExecuteAction::CreateStatic(&FIGCExtensionActions::Action2), FCanExecuteAction());
IGCCommandList->MapAction(CustomExtensionCommands::Get().Command3, FExecuteAction::CreateStatic(&FIGCExtensionActions::Action3), FCanExecuteAction());
FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
static bool IsCheckedBox1;
static bool IsCheckedBox2;
static TArray<TSharedPtr<FString>> ComboboxOptions;
static TSharedPtr<FString> SelectedOption;
ComboboxOptions.Add(MakeShareable(new FString("Value1")));
ComboboxOptions.Add(MakeShareable(new FString("Value2")));
ComboboxOptions.Add(MakeShareable(new FString("Value3")));
struct IGCToolbar
{
static void CreateIGCToolbar(FToolBarBuilder& ToolbarBuilder)
{
ToolbarBuilder.BeginSection("IGCToolbar");
{
ToolbarBuilder.AddToolBarWidget(
SNew(SButton)
.OnClicked_Lambda([]()->FReply { FIGCExtensionActions::Action1(); return FReply::Handled(); })
[
SNew(STextBlock)
.Text(FText::FromString("LevelTool"))
]
);
ToolbarBuilder.AddToolBarButton(
CustomExtensionCommands::Get().Command2,
NAME_None,
TAttribute<FText>(),
TAttribute<FText>(),
FSlateIcon(),
NAME_None
);
ToolbarBuilder.AddToolBarButton(
CustomExtensionCommands::Get().Command3,
NAME_None,
TAttribute<FText>(),
TAttribute<FText>(),
FSlateIcon(),
NAME_None
);
ToolbarBuilder.AddToolBarWidget(
SNew(SCheckBox)
.OnCheckStateChanged_Lambda(&FIGCExtensionActions::Action4)
.IsChecked(IsCheckedBox1),
LOCTEXT("SCCheckBox", "CheckBox1")
);
ToolbarBuilder.AddToolBarWidget(
SNew(SCheckBox)
.OnCheckStateChanged_Lambda(&FIGCExtensionActions::Action5)
.IsChecked(IsCheckedBox2),
LOCTEXT("SCCheckBox", "CheckBox2")
);
ToolbarBuilder.AddToolBarWidget(
SNew(SBox)
.Padding(FMargin(20.f, 0.f, 0.f, 0.f))
[
SNew(SComboBox<TSharedPtr<FString>>)
.OptionsSource(&ComboboxOptions)
.ToolTipText(LOCTEXT("PlatformComboBox", "Change Build Platform"))
.OnGenerateWidget_Lambda([](TSharedPtr<FString> Option)
{
return SNew(STextBlock).Text(FText::FromString(*Option.Get()));
})
.OnSelectionChanged_Lambda([](TSharedPtr<FString> NewSelection, ESelectInfo::Type SelectInfo)
{
if (NewSelection.IsValid())
{
SelectedOption = NewSelection;
FIGCExtensionActions::Action6(SelectedOption);
}
})
.InitiallySelectedItem(SelectedOption)
.Content()
[
SNew(STextBlock)
.Text_Lambda([]()
{
return SelectedOption.IsValid() ? FText::FromString(*SelectedOption) : LOCTEXT("NoSelection", "선택없음");
})
]
]
, LOCTEXT("SCComboBox", "ComboBox"));
}
ToolbarBuilder.EndSection();
}
};
TSharedPtr<FExtender> IGCToolbarExtender = MakeShareable(new FExtender());
IGCToolbarExtender->AddToolBarExtension("Play", EExtensionHook::After, IGCCommandList,
FToolBarExtensionDelegate::CreateStatic(&IGCToolbar::CreateIGCToolbar));
LevelEditorModule.GetToolBarExtensibilityManager()->AddExtender(IGCToolbarExtender);
}
void FEditorUtilityModule::ShutdownModule()
{
CustomExtensionCommands::Unregister();
CustomSlateStyle::Shutdown();
}
#endif

View File

@ -0,0 +1,24 @@
#if WITH_EDITOR
#pragma once
#include "Engine.h"
#include "Modules/ModuleInterface.h"
#include "Modules/ModuleManager.h"
class FEditorUtilityModule : public IModuleInterface
{
public:
virtual void StartupModule()override;
virtual void ShutdownModule()override;
private:
TSharedPtr<class FUICommandList> IGCCommandList;
};
#endif

View File

@ -0,0 +1,24 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MessageAlert.h"
#include "Widgets/Notifications/SNotificationList.h"
#include "Framework/Notifications/NotificationManager.h"
MessageAlert::MessageAlert()
{
}
MessageAlert::~MessageAlert()
{
}
void MessageAlert::ShowNotifyInfo(const FString& Msg)
{
FNotificationInfo NotifyInfo(FText::FromString(Msg));
NotifyInfo.bUseLargeFont = true;
NotifyInfo.FadeOutDuration = 5.f;
FSlateNotificationManager::Get().AddNotification(NotifyInfo);
}

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
/**
*
*/
class EDITORUTILITYMODULE_API MessageAlert
{
public:
MessageAlert();
~MessageAlert();
public:
static void ShowNotifyInfo(const FString& Msg);
};

15
Source/ProjectT.Target.cs Normal file
View File

@ -0,0 +1,15 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class ProjectTTarget : TargetRules
{
public ProjectTTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V5;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_5;
ExtraModuleNames.AddRange(new string[] { "ProjectT" , "EditorUtilityModule"});
}
}

View File

@ -0,0 +1,55 @@
//Generated ContentType Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EContentType : uint8
{
None = 0 UMETA(DisplayName = "None"),
Stage = 10 UMETA(DisplayName= "Stage"),
Objective = 11 UMETA(DisplayName= "Objective"),
CharacterUnlock = 14 UMETA(DisplayName= "CharacterUnlock"),
PlayerCharacter = 20 UMETA(DisplayName= "PlayerCharacter"),
EnemyNpc = 21 UMETA(DisplayName= "EnemyNpc"),
ObjectiveNpc = 22 UMETA(DisplayName= "ObjectiveNpc"),
Effect = 30 UMETA(DisplayName= "Effect"),
Skill = 31 UMETA(DisplayName= "Skill"),
Item = 40 UMETA(DisplayName= "Item"),
ItemSet = 41 UMETA(DisplayName= "ItemSet"),
LevelObject = 42 UMETA(DisplayName= "LevelObject"),
Localization = 60 UMETA(DisplayName= "Localization"),
Mesh = 80 UMETA(DisplayName= "Mesh"),
MeshSet = 81 UMETA(DisplayName= "MeshSet"),
Animation = 82 UMETA(DisplayName= "Animation"),
Sound = 91 UMETA(DisplayName= "Sound"),
Haptic = 93 UMETA(DisplayName= "Haptic"),
Vfx = 94 UMETA(DisplayName= "Vfx"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EContentType,EContentType::Stage,EContentType::Vfx);
static FString EnumToString(EContentType InEnum)
{
switch (InEnum)
{
case EContentType::Stage: return TEXT("Stage");
case EContentType::Objective: return TEXT("Objective");
case EContentType::CharacterUnlock: return TEXT("CharacterUnlock");
case EContentType::PlayerCharacter: return TEXT("PlayerCharacter");
case EContentType::EnemyNpc: return TEXT("EnemyNpc");
case EContentType::ObjectiveNpc: return TEXT("ObjectiveNpc");
case EContentType::Effect: return TEXT("Effect");
case EContentType::Skill: return TEXT("Skill");
case EContentType::Item: return TEXT("Item");
case EContentType::ItemSet: return TEXT("ItemSet");
case EContentType::LevelObject: return TEXT("LevelObject");
case EContentType::Localization: return TEXT("Localization");
case EContentType::Mesh: return TEXT("Mesh");
case EContentType::MeshSet: return TEXT("MeshSet");
case EContentType::Animation: return TEXT("Animation");
case EContentType::Sound: return TEXT("Sound");
case EContentType::Haptic: return TEXT("Haptic");
case EContentType::Vfx: return TEXT("Vfx");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,54 @@
//Generated DataTableKey Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EDataTableKey : uint8
{
AnimationSet UMETA(DisplayName = "AnimationSet"),
CharacterMeshSet UMETA(DisplayName = "CharacterMeshSet"),
CharacterUnlock UMETA(DisplayName = "CharacterUnlock"),
Effect UMETA(DisplayName = "Effect"),
EnemyNpc UMETA(DisplayName = "EnemyNpc"),
HapticList UMETA(DisplayName = "HapticList"),
Item UMETA(DisplayName = "Item"),
ItemSet UMETA(DisplayName = "ItemSet"),
LevelObject UMETA(DisplayName = "LevelObject"),
Localization UMETA(DisplayName = "Localization"),
MeshList UMETA(DisplayName = "MeshList"),
Objective UMETA(DisplayName = "Objective"),
PlayerCharacter UMETA(DisplayName = "PlayerCharacter"),
Skill UMETA(DisplayName = "Skill"),
SocketList UMETA(DisplayName = "SocketList"),
SoundList UMETA(DisplayName = "SoundList"),
Stage UMETA(DisplayName = "Stage"),
VfxList UMETA(DisplayName = "VfxList"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EDataTableKey,EDataTableKey::AnimationSet,EDataTableKey::VfxList);
static FString EnumToString(EDataTableKey InEnum)
{
switch (InEnum)
{
case EDataTableKey::AnimationSet: return TEXT("AnimationSet");
case EDataTableKey::CharacterMeshSet: return TEXT("CharacterMeshSet");
case EDataTableKey::CharacterUnlock: return TEXT("CharacterUnlock");
case EDataTableKey::Effect: return TEXT("Effect");
case EDataTableKey::EnemyNpc: return TEXT("EnemyNpc");
case EDataTableKey::HapticList: return TEXT("HapticList");
case EDataTableKey::Item: return TEXT("Item");
case EDataTableKey::ItemSet: return TEXT("ItemSet");
case EDataTableKey::LevelObject: return TEXT("LevelObject");
case EDataTableKey::Localization: return TEXT("Localization");
case EDataTableKey::MeshList: return TEXT("MeshList");
case EDataTableKey::Objective: return TEXT("Objective");
case EDataTableKey::PlayerCharacter: return TEXT("PlayerCharacter");
case EDataTableKey::Skill: return TEXT("Skill");
case EDataTableKey::SocketList: return TEXT("SocketList");
case EDataTableKey::SoundList: return TEXT("SoundList");
case EDataTableKey::Stage: return TEXT("Stage");
case EDataTableKey::VfxList: return TEXT("VfxList");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,41 @@
//Generated EffectSubTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EEffectSubTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Hitback UMETA(DisplayName= "Hitback"),
Jumpback UMETA(DisplayName= "Jumpback"),
Stun UMETA(DisplayName= "Stun"),
Bind UMETA(DisplayName= "Bind"),
Surge UMETA(DisplayName= "Surge"),
Unrecog UMETA(DisplayName= "Unrecog"),
CogImmune UMETA(DisplayName= "CogImmune"),
HitbackImmune UMETA(DisplayName= "HitbackImmune"),
Fast UMETA(DisplayName= "Fast"),
Slow UMETA(DisplayName= "Slow"),
Heal UMETA(DisplayName= "Heal"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EEffectSubTypes,EEffectSubTypes::Hitback,EEffectSubTypes::Heal);
static FString EnumToString(EEffectSubTypes InEnum)
{
switch (InEnum)
{
case EEffectSubTypes::Hitback: return TEXT("Hitback");
case EEffectSubTypes::Jumpback: return TEXT("Jumpback");
case EEffectSubTypes::Stun: return TEXT("Stun");
case EEffectSubTypes::Bind: return TEXT("Bind");
case EEffectSubTypes::Surge: return TEXT("Surge");
case EEffectSubTypes::Unrecog: return TEXT("Unrecog");
case EEffectSubTypes::CogImmune: return TEXT("CogImmune");
case EEffectSubTypes::HitbackImmune: return TEXT("HitbackImmune");
case EEffectSubTypes::Fast: return TEXT("Fast");
case EEffectSubTypes::Slow: return TEXT("Slow");
case EEffectSubTypes::Heal: return TEXT("Heal");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,25 @@
//Generated EffectTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EEffectTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
CC UMETA(DisplayName= "CC"),
Utility UMETA(DisplayName= "Utility"),
Status UMETA(DisplayName= "Status"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EEffectTypes,EEffectTypes::CC,EEffectTypes::Status);
static FString EnumToString(EEffectTypes InEnum)
{
switch (InEnum)
{
case EEffectTypes::CC: return TEXT("CC");
case EEffectTypes::Utility: return TEXT("Utility");
case EEffectTypes::Status: return TEXT("Status");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,25 @@
//Generated EnemyNpc Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EEnemyNpc : uint8
{
None = 0 UMETA(DisplayName = "None"),
Stationary UMETA(DisplayName= "Stationary"),
Patrol UMETA(DisplayName= "Patrol"),
Fixed UMETA(DisplayName= "Fixed"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EEnemyNpc,EEnemyNpc::Stationary,EEnemyNpc::Fixed);
static FString EnumToString(EEnemyNpc InEnum)
{
switch (InEnum)
{
case EEnemyNpc::Stationary: return TEXT("Stationary");
case EEnemyNpc::Patrol: return TEXT("Patrol");
case EEnemyNpc::Fixed: return TEXT("Fixed");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,25 @@
//Generated ItemTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EItemTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Gimick UMETA(DisplayName= "Gimick"),
Usable UMETA(DisplayName= "Usable"),
Collection UMETA(DisplayName= "Collection"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EItemTypes,EItemTypes::Gimick,EItemTypes::Collection);
static FString EnumToString(EItemTypes InEnum)
{
switch (InEnum)
{
case EItemTypes::Gimick: return TEXT("Gimick");
case EItemTypes::Usable: return TEXT("Usable");
case EItemTypes::Collection: return TEXT("Collection");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,23 @@
//Generated LevelObjectTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class ELevelObjectTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Cast UMETA(DisplayName= "Cast"),
Trap UMETA(DisplayName= "Trap"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(ELevelObjectTypes,ELevelObjectTypes::Cast,ELevelObjectTypes::Trap);
static FString EnumToString(ELevelObjectTypes InEnum)
{
switch (InEnum)
{
case ELevelObjectTypes::Cast: return TEXT("Cast");
case ELevelObjectTypes::Trap: return TEXT("Trap");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,25 @@
//Generated NpcTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class ENpcTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Stationary UMETA(DisplayName= "Stationary"),
Patrol UMETA(DisplayName= "Patrol"),
Fixed UMETA(DisplayName= "Fixed"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(ENpcTypes,ENpcTypes::Stationary,ENpcTypes::Fixed);
static FString EnumToString(ENpcTypes InEnum)
{
switch (InEnum)
{
case ENpcTypes::Stationary: return TEXT("Stationary");
case ENpcTypes::Patrol: return TEXT("Patrol");
case ENpcTypes::Fixed: return TEXT("Fixed");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,27 @@
//Generated ObjectiveSubTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EObjectiveSubTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Save UMETA(DisplayName= "Save"),
Collect UMETA(DisplayName= "Collect"),
Avoid UMETA(DisplayName= "Avoid"),
Kill UMETA(DisplayName= "Kill"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EObjectiveSubTypes,EObjectiveSubTypes::Save,EObjectiveSubTypes::Kill);
static FString EnumToString(EObjectiveSubTypes InEnum)
{
switch (InEnum)
{
case EObjectiveSubTypes::Save: return TEXT("Save");
case EObjectiveSubTypes::Collect: return TEXT("Collect");
case EObjectiveSubTypes::Avoid: return TEXT("Avoid");
case EObjectiveSubTypes::Kill: return TEXT("Kill");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,23 @@
//Generated ObjectiveTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EObjectiveTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Mission UMETA(DisplayName= "Mission"),
Quest UMETA(DisplayName= "Quest"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EObjectiveTypes,EObjectiveTypes::Mission,EObjectiveTypes::Quest);
static FString EnumToString(EObjectiveTypes InEnum)
{
switch (InEnum)
{
case EObjectiveTypes::Mission: return TEXT("Mission");
case EObjectiveTypes::Quest: return TEXT("Quest");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,27 @@
//Generated SkillTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class ESkillTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Melee UMETA(DisplayName= "Melee"),
Direct UMETA(DisplayName= "Direct"),
Indirect UMETA(DisplayName= "Indirect"),
Buff UMETA(DisplayName= "Buff"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(ESkillTypes,ESkillTypes::Melee,ESkillTypes::Buff);
static FString EnumToString(ESkillTypes InEnum)
{
switch (InEnum)
{
case ESkillTypes::Melee: return TEXT("Melee");
case ESkillTypes::Direct: return TEXT("Direct");
case ESkillTypes::Indirect: return TEXT("Indirect");
case ESkillTypes::Buff: return TEXT("Buff");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,37 @@
//Generated Stage Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EStage : uint8
{
None = 0 UMETA(DisplayName = "None"),
L_SP_Office_01 UMETA(DisplayName= "L_SP_Office_01"),
L_SP_Office_02 UMETA(DisplayName= "L_SP_Office_02"),
L_SP_Office_03 UMETA(DisplayName= "L_SP_Office_03"),
L_SP_Office_04 UMETA(DisplayName= "L_SP_Office_04"),
L_SP_Office_05 UMETA(DisplayName= "L_SP_Office_05"),
L_SP_Test_00 UMETA(DisplayName= "L_SP_Test_00"),
L_Entry UMETA(DisplayName= "L_Entry"),
L_Lobby UMETA(DisplayName= "L_Lobby"),
L_Intro UMETA(DisplayName= "L_Intro"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EStage,EStage::L_SP_Office_01,EStage::L_Intro);
static FString EnumToString(EStage InEnum)
{
switch (InEnum)
{
case EStage::L_SP_Office_01: return TEXT("L_SP_Office_01");
case EStage::L_SP_Office_02: return TEXT("L_SP_Office_02");
case EStage::L_SP_Office_03: return TEXT("L_SP_Office_03");
case EStage::L_SP_Office_04: return TEXT("L_SP_Office_04");
case EStage::L_SP_Office_05: return TEXT("L_SP_Office_05");
case EStage::L_SP_Test_00: return TEXT("L_SP_Test_00");
case EStage::L_Entry: return TEXT("L_Entry");
case EStage::L_Lobby: return TEXT("L_Lobby");
case EStage::L_Intro: return TEXT("L_Intro");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,25 @@
//Generated UnlockTypes Index to Enum
#pragma once
UENUM(BlueprintType)
enum class EUnlockTypes : uint8
{
None = 0 UMETA(DisplayName = "None"),
Default UMETA(DisplayName= "Default"),
Mission UMETA(DisplayName= "Mission"),
Quest UMETA(DisplayName= "Quest"),
};
ENUM_RANGE_BY_FIRST_AND_LAST(EUnlockTypes,EUnlockTypes::Default,EUnlockTypes::Quest);
static FString EnumToString(EUnlockTypes InEnum)
{
switch (InEnum)
{
case EUnlockTypes::Default: return TEXT("Default");
case EUnlockTypes::Mission: return TEXT("Mission");
case EUnlockTypes::Quest: return TEXT("Quest");
default: checkf(false, TEXT("Error"));
}
return FString();
}

View File

@ -0,0 +1,33 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructAnimationSet.generated.h"
USTRUCT(BlueprintType)
struct FAnimationSet : public FTableRowBase
{
GENERATED_BODY()
FAnimationSet() :
sIdleAniPath()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = AnimationSet)
FString sIdleAniPath;
bool operator==(const FAnimationSet& Other) const
{
return sIdleAniPath == Other.sIdleAniPath;
}
bool operator!=(const FAnimationSet& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sIdleAniPath.IsEmpty();
}
};

View File

@ -0,0 +1,41 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructCharacterMeshSet.generated.h"
USTRUCT(BlueprintType)
struct FCharacterMeshSet : public FTableRowBase
{
GENERATED_BODY()
FCharacterMeshSet() :
iBodyMeshId(),
iWeaponMeshId(),
iWeaponSocketId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = CharacterMeshSet)
int32 iBodyMeshId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = CharacterMeshSet)
int32 iWeaponMeshId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = CharacterMeshSet)
int32 iWeaponSocketId;
bool operator==(const FCharacterMeshSet& Other) const
{
return iBodyMeshId == Other.iBodyMeshId && iWeaponMeshId == Other.iWeaponMeshId && iWeaponSocketId == Other.iWeaponSocketId;
}
bool operator!=(const FCharacterMeshSet& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return iBodyMeshId == 0 && iWeaponMeshId == 0 && iWeaponSocketId == 0;
}
};

View File

@ -0,0 +1,45 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructCharacterUnlock.generated.h"
USTRUCT(BlueprintType)
struct FCharacterUnlock : public FTableRowBase
{
GENERATED_BODY()
FCharacterUnlock() :
sUnlockType(),
iPlayerCharId(),
iClearStage(),
iUnlockDescId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = CharacterUnlock)
FString sUnlockType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = CharacterUnlock)
int32 iPlayerCharId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = CharacterUnlock)
int32 iClearStage;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = CharacterUnlock)
int32 iUnlockDescId;
bool operator==(const FCharacterUnlock& Other) const
{
return sUnlockType == Other.sUnlockType && iPlayerCharId == Other.iPlayerCharId && iClearStage == Other.iClearStage && iUnlockDescId == Other.iUnlockDescId;
}
bool operator!=(const FCharacterUnlock& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sUnlockType.IsEmpty() && iPlayerCharId == 0 && iClearStage == 0 && iUnlockDescId == 0;
}
};

View File

@ -0,0 +1,57 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructEffect.generated.h"
USTRUCT(BlueprintType)
struct FEffect : public FTableRowBase
{
GENERATED_BODY()
FEffect() :
sEffectType(),
sEffect(),
fEffectValue(),
fEffectDuration(),
iEffectNameId(),
iEffectDescId(),
sEffectIconPath()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Effect)
FString sEffectType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Effect)
FString sEffect;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Effect)
float fEffectValue;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Effect)
float fEffectDuration;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Effect)
int32 iEffectNameId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Effect)
int32 iEffectDescId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Effect)
FString sEffectIconPath;
bool operator==(const FEffect& Other) const
{
return sEffectType == Other.sEffectType && sEffect == Other.sEffect && fEffectValue == Other.fEffectValue && fEffectDuration == Other.fEffectDuration && iEffectNameId == Other.iEffectNameId && iEffectDescId == Other.iEffectDescId && sEffectIconPath == Other.sEffectIconPath;
}
bool operator!=(const FEffect& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sEffectType.IsEmpty() && sEffect.IsEmpty() && fEffectValue == 0 && fEffectDuration == 0 && iEffectNameId == 0 && iEffectDescId == 0 && sEffectIconPath.IsEmpty();
}
};

View File

@ -0,0 +1,101 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructEnemyNpc.generated.h"
USTRUCT(BlueprintType)
struct FEnemyNpc : public FTableRowBase
{
GENERATED_BODY()
FEnemyNpc() :
sNpcType(),
fNpcHp(),
fNpcMove(),
fNpcRun(),
fSightLength(),
fSightAngle(),
fAttackLength(),
fChaseLength(),
fRotationAngle(),
fRotationSpeed(),
fDoubtTime(),
fNpcNoise(),
fMoveProb(),
fSearchProb(),
fScoutProb(),
iNpcAttackId(),
iNpcNameId(),
iNpcMeshSetId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
FString sNpcType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fNpcHp;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fNpcMove;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fNpcRun;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fSightLength;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fSightAngle;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fAttackLength;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fChaseLength;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fRotationAngle;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fRotationSpeed;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fDoubtTime;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fNpcNoise;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fMoveProb;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fSearchProb;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
float fScoutProb;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
int32 iNpcAttackId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
int32 iNpcNameId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = EnemyNpc)
int32 iNpcMeshSetId;
bool operator==(const FEnemyNpc& Other) const
{
return sNpcType == Other.sNpcType && fNpcHp == Other.fNpcHp && fNpcMove == Other.fNpcMove && fNpcRun == Other.fNpcRun && fSightLength == Other.fSightLength && fSightAngle == Other.fSightAngle && fAttackLength == Other.fAttackLength && fChaseLength == Other.fChaseLength && fRotationAngle == Other.fRotationAngle && fRotationSpeed == Other.fRotationSpeed && fDoubtTime == Other.fDoubtTime && fNpcNoise == Other.fNpcNoise && fMoveProb == Other.fMoveProb && fSearchProb == Other.fSearchProb && fScoutProb == Other.fScoutProb && iNpcAttackId == Other.iNpcAttackId && iNpcNameId == Other.iNpcNameId && iNpcMeshSetId == Other.iNpcMeshSetId;
}
bool operator!=(const FEnemyNpc& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sNpcType.IsEmpty() && fNpcHp == 0 && fNpcMove == 0 && fNpcRun == 0 && fSightLength == 0 && fSightAngle == 0 && fAttackLength == 0 && fChaseLength == 0 && fRotationAngle == 0 && fRotationSpeed == 0 && fDoubtTime == 0 && fNpcNoise == 0 && fMoveProb == 0 && fSearchProb == 0 && fScoutProb == 0 && iNpcAttackId == 0 && iNpcNameId == 0 && iNpcMeshSetId == 0;
}
};

View File

@ -0,0 +1,33 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructHapticList.generated.h"
USTRUCT(BlueprintType)
struct FHapticList : public FTableRowBase
{
GENERATED_BODY()
FHapticList() :
sHapticPath()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = HapticList)
FString sHapticPath;
bool operator==(const FHapticList& Other) const
{
return sHapticPath == Other.sHapticPath;
}
bool operator!=(const FHapticList& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sHapticPath.IsEmpty();
}
};

View File

@ -0,0 +1,53 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructItem.generated.h"
USTRUCT(BlueprintType)
struct FItem : public FTableRowBase
{
GENERATED_BODY()
FItem() :
sItemType(),
iItemSkillId(),
iItemMeshId(),
sItemIconPath(),
iItemNameId(),
iItemDescId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Item)
FString sItemType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Item)
int32 iItemSkillId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Item)
int32 iItemMeshId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Item)
FString sItemIconPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Item)
int32 iItemNameId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Item)
int32 iItemDescId;
bool operator==(const FItem& Other) const
{
return sItemType == Other.sItemType && iItemSkillId == Other.iItemSkillId && iItemMeshId == Other.iItemMeshId && sItemIconPath == Other.sItemIconPath && iItemNameId == Other.iItemNameId && iItemDescId == Other.iItemDescId;
}
bool operator!=(const FItem& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sItemType.IsEmpty() && iItemSkillId == 0 && iItemMeshId == 0 && sItemIconPath.IsEmpty() && iItemNameId == 0 && iItemDescId == 0;
}
};

View File

@ -0,0 +1,41 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructItemSet.generated.h"
USTRUCT(BlueprintType)
struct FItemSet : public FTableRowBase
{
GENERATED_BODY()
FItemSet() :
iItemGroupId(),
iItemId(),
iProbWeight()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = ItemSet)
int32 iItemGroupId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = ItemSet)
int32 iItemId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = ItemSet)
int32 iProbWeight;
bool operator==(const FItemSet& Other) const
{
return iItemGroupId == Other.iItemGroupId && iItemId == Other.iItemId && iProbWeight == Other.iProbWeight;
}
bool operator!=(const FItemSet& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return iItemGroupId == 0 && iItemId == 0 && iProbWeight == 0;
}
};

View File

@ -0,0 +1,37 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructLevelObject.generated.h"
USTRUCT(BlueprintType)
struct FLevelObject : public FTableRowBase
{
GENERATED_BODY()
FLevelObject() :
sLevelObjType(),
iCastItemId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = LevelObject)
FString sLevelObjType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = LevelObject)
int32 iCastItemId;
bool operator==(const FLevelObject& Other) const
{
return sLevelObjType == Other.sLevelObjType && iCastItemId == Other.iCastItemId;
}
bool operator!=(const FLevelObject& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sLevelObjType.IsEmpty() && iCastItemId == 0;
}
};

View File

@ -0,0 +1,37 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructLocalization.generated.h"
USTRUCT(BlueprintType)
struct FLocalization : public FTableRowBase
{
GENERATED_BODY()
FLocalization() :
sKorean(),
sEnglish()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Localization)
FString sKorean;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Localization)
FString sEnglish;
bool operator==(const FLocalization& Other) const
{
return sKorean == Other.sKorean && sEnglish == Other.sEnglish;
}
bool operator!=(const FLocalization& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sKorean.IsEmpty() && sEnglish.IsEmpty();
}
};

View File

@ -0,0 +1,33 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructMeshList.generated.h"
USTRUCT(BlueprintType)
struct FMeshList : public FTableRowBase
{
GENERATED_BODY()
FMeshList() :
sMeshPath()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = MeshList)
FString sMeshPath;
bool operator==(const FMeshList& Other) const
{
return sMeshPath == Other.sMeshPath;
}
bool operator!=(const FMeshList& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sMeshPath.IsEmpty();
}
};

View File

@ -0,0 +1,49 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructObjective.generated.h"
USTRUCT(BlueprintType)
struct FObjective : public FTableRowBase
{
GENERATED_BODY()
FObjective() :
sObjectiveType(),
sObjectiveSubType(),
iObjectiveItemId(),
iObjectiveCount(),
iObjectiveDescId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Objective)
FString sObjectiveType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Objective)
FString sObjectiveSubType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Objective)
int32 iObjectiveItemId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Objective)
int32 iObjectiveCount;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Objective)
int32 iObjectiveDescId;
bool operator==(const FObjective& Other) const
{
return sObjectiveType == Other.sObjectiveType && sObjectiveSubType == Other.sObjectiveSubType && iObjectiveItemId == Other.iObjectiveItemId && iObjectiveCount == Other.iObjectiveCount && iObjectiveDescId == Other.iObjectiveDescId;
}
bool operator!=(const FObjective& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sObjectiveType.IsEmpty() && sObjectiveSubType.IsEmpty() && iObjectiveItemId == 0 && iObjectiveCount == 0 && iObjectiveDescId == 0;
}
};

View File

@ -0,0 +1,117 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructPlayerCharacter.generated.h"
USTRUCT(BlueprintType)
struct FPlayerCharacter : public FTableRowBase
{
GENERATED_BODY()
FPlayerCharacter() :
fCharHp(),
fCharMove(),
fCharMoveSound(),
fCharRun(),
fCharRunSound(),
fStamina(),
fStaRecovery(),
iItemSlot(),
iCharAttackId(),
iCharSkillId(),
iCharNameId(),
iCharDescId(),
iPassiveName1Id(),
iPassiveDesc1Id(),
iPassiveName2Id(),
iPassiveDesc2Id(),
iPassiveName3Id(),
iPassiveDesc3Id(),
iCharMeshSetId(),
iCharAniSetId(),
sCharBlueprintPath(),
sCharIconPath()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
float fCharHp;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
float fCharMove;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
float fCharMoveSound;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
float fCharRun;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
float fCharRunSound;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
float fStamina;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
float fStaRecovery;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iItemSlot;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iCharAttackId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iCharSkillId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iCharNameId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iCharDescId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iPassiveName1Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iPassiveDesc1Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iPassiveName2Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iPassiveDesc2Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iPassiveName3Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iPassiveDesc3Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iCharMeshSetId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
int32 iCharAniSetId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
FString sCharBlueprintPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = PlayerCharacter)
FString sCharIconPath;
bool operator==(const FPlayerCharacter& Other) const
{
return fCharHp == Other.fCharHp && fCharMove == Other.fCharMove && fCharMoveSound == Other.fCharMoveSound && fCharRun == Other.fCharRun && fCharRunSound == Other.fCharRunSound && fStamina == Other.fStamina && fStaRecovery == Other.fStaRecovery && iItemSlot == Other.iItemSlot && iCharAttackId == Other.iCharAttackId && iCharSkillId == Other.iCharSkillId && iCharNameId == Other.iCharNameId && iCharDescId == Other.iCharDescId && iPassiveName1Id == Other.iPassiveName1Id && iPassiveDesc1Id == Other.iPassiveDesc1Id && iPassiveName2Id == Other.iPassiveName2Id && iPassiveDesc2Id == Other.iPassiveDesc2Id && iPassiveName3Id == Other.iPassiveName3Id && iPassiveDesc3Id == Other.iPassiveDesc3Id && iCharMeshSetId == Other.iCharMeshSetId && iCharAniSetId == Other.iCharAniSetId && sCharBlueprintPath == Other.sCharBlueprintPath && sCharIconPath == Other.sCharIconPath;
}
bool operator!=(const FPlayerCharacter& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return fCharHp == 0 && fCharMove == 0 && fCharMoveSound == 0 && fCharRun == 0 && fCharRunSound == 0 && fStamina == 0 && fStaRecovery == 0 && iItemSlot == 0 && iCharAttackId == 0 && iCharSkillId == 0 && iCharNameId == 0 && iCharDescId == 0 && iPassiveName1Id == 0 && iPassiveDesc1Id == 0 && iPassiveName2Id == 0 && iPassiveDesc2Id == 0 && iPassiveName3Id == 0 && iPassiveDesc3Id == 0 && iCharMeshSetId == 0 && iCharAniSetId == 0 && sCharBlueprintPath.IsEmpty() && sCharIconPath.IsEmpty();
}
};

View File

@ -0,0 +1,101 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructSkill.generated.h"
USTRUCT(BlueprintType)
struct FSkill : public FTableRowBase
{
GENERATED_BODY()
FSkill() :
sSkillName(),
sSkillType(),
sSkillIconPath(),
fCooldown(),
fDamage(),
fCriDmg(),
fSkillNoise(),
fCorrectRange(),
fSkillRange(),
fProjectileSpeed(),
fEffectRange(),
iEffect1Id(),
iEffect2Id(),
iEffect3Id(),
sSkillBpPath(),
iSkillSocketId(),
iSkillNameId(),
iSkillDescId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
FString sSkillName;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
FString sSkillType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
FString sSkillIconPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fCooldown;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fDamage;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fCriDmg;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fSkillNoise;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fCorrectRange;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fSkillRange;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fProjectileSpeed;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
float fEffectRange;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
int32 iEffect1Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
int32 iEffect2Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
int32 iEffect3Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
FString sSkillBpPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
int32 iSkillSocketId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
int32 iSkillNameId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Skill)
int32 iSkillDescId;
bool operator==(const FSkill& Other) const
{
return sSkillName == Other.sSkillName && sSkillType == Other.sSkillType && sSkillIconPath == Other.sSkillIconPath && fCooldown == Other.fCooldown && fDamage == Other.fDamage && fCriDmg == Other.fCriDmg && fSkillNoise == Other.fSkillNoise && fCorrectRange == Other.fCorrectRange && fSkillRange == Other.fSkillRange && fProjectileSpeed == Other.fProjectileSpeed && fEffectRange == Other.fEffectRange && iEffect1Id == Other.iEffect1Id && iEffect2Id == Other.iEffect2Id && iEffect3Id == Other.iEffect3Id && sSkillBpPath == Other.sSkillBpPath && iSkillSocketId == Other.iSkillSocketId && iSkillNameId == Other.iSkillNameId && iSkillDescId == Other.iSkillDescId;
}
bool operator!=(const FSkill& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sSkillName.IsEmpty() && sSkillType.IsEmpty() && sSkillIconPath.IsEmpty() && fCooldown == 0 && fDamage == 0 && fCriDmg == 0 && fSkillNoise == 0 && fCorrectRange == 0 && fSkillRange == 0 && fProjectileSpeed == 0 && fEffectRange == 0 && iEffect1Id == 0 && iEffect2Id == 0 && iEffect3Id == 0 && sSkillBpPath.IsEmpty() && iSkillSocketId == 0 && iSkillNameId == 0 && iSkillDescId == 0;
}
};

View File

@ -0,0 +1,33 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructSocketList.generated.h"
USTRUCT(BlueprintType)
struct FSocketList : public FTableRowBase
{
GENERATED_BODY()
FSocketList() :
sSocketName()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = SocketList)
FString sSocketName;
bool operator==(const FSocketList& Other) const
{
return sSocketName == Other.sSocketName;
}
bool operator!=(const FSocketList& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sSocketName.IsEmpty();
}
};

View File

@ -0,0 +1,49 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructSoundList.generated.h"
USTRUCT(BlueprintType)
struct FSoundList : public FTableRowBase
{
GENERATED_BODY()
FSoundList() :
sSoundClass(),
sSoundType(),
sSoundPath(),
sAttenPath(),
bLooping()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = SoundList)
FString sSoundClass;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = SoundList)
FString sSoundType;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = SoundList)
FString sSoundPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = SoundList)
FString sAttenPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = SoundList)
bool bLooping;
bool operator==(const FSoundList& Other) const
{
return sSoundClass == Other.sSoundClass && sSoundType == Other.sSoundType && sSoundPath == Other.sSoundPath && sAttenPath == Other.sAttenPath && bLooping == Other.bLooping;
}
bool operator!=(const FSoundList& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sSoundClass.IsEmpty() && sSoundType.IsEmpty() && sSoundPath.IsEmpty() && sAttenPath.IsEmpty() && bLooping == 0;
}
};

View File

@ -0,0 +1,77 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructStage.generated.h"
USTRUCT(BlueprintType)
struct FStage : public FTableRowBase
{
GENERATED_BODY()
FStage() :
iMissionId(),
iQuest1Id(),
iQuest2Id(),
iQuest3Id(),
iTimeLimit(),
iNextStageId(),
sStageName(),
sStagePath(),
sStageThumbnailPath(),
sStageBackgroundPath(),
iStageNameId(),
iStageDescId()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iMissionId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iQuest1Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iQuest2Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iQuest3Id;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iTimeLimit;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iNextStageId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
FString sStageName;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
FString sStagePath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
FString sStageThumbnailPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
FString sStageBackgroundPath;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iStageNameId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Stage)
int32 iStageDescId;
bool operator==(const FStage& Other) const
{
return iMissionId == Other.iMissionId && iQuest1Id == Other.iQuest1Id && iQuest2Id == Other.iQuest2Id && iQuest3Id == Other.iQuest3Id && iTimeLimit == Other.iTimeLimit && iNextStageId == Other.iNextStageId && sStageName == Other.sStageName && sStagePath == Other.sStagePath && sStageThumbnailPath == Other.sStageThumbnailPath && sStageBackgroundPath == Other.sStageBackgroundPath && iStageNameId == Other.iStageNameId && iStageDescId == Other.iStageDescId;
}
bool operator!=(const FStage& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return iMissionId == 0 && iQuest1Id == 0 && iQuest2Id == 0 && iQuest3Id == 0 && iTimeLimit == 0 && iNextStageId == 0 && sStageName.IsEmpty() && sStagePath.IsEmpty() && sStageThumbnailPath.IsEmpty() && sStageBackgroundPath.IsEmpty() && iStageNameId == 0 && iStageDescId == 0;
}
};

View File

@ -0,0 +1,33 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GenerateStructVfxList.generated.h"
USTRUCT(BlueprintType)
struct FVfxList : public FTableRowBase
{
GENERATED_BODY()
FVfxList() :
sVfxPath()
{
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = VfxList)
FString sVfxPath;
bool operator==(const FVfxList& Other) const
{
return sVfxPath == Other.sVfxPath;
}
bool operator!=(const FVfxList& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return sVfxPath.IsEmpty();
}
};

View File

@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "NpcDataModel.h"

View File

@ -0,0 +1,153 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "NpcDataModel.generated.h"
USTRUCT(Blueprintable)
struct FCrowdSettingsInfo
{
GENERATED_BODY()
FCrowdSettingsInfo() :
bUseCrowdSeparation(true),
SeparationWeight(10.f),
AvoidanceRangeMultiplier(1.f)
{}
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "CrowdSettings")
uint8 bUseCrowdSeparation : 1;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "CrowdSettings", meta = (EditCondition = "bUseCrowdSeparation"), meta = (Tooltip = "NPC 간 거리 유지 강도"))
float SeparationWeight;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "CrowdSettings", meta = (EditCondition = "bUseCrowdSeparation"), meta = (Tooltip = "회피 반응 배율"))
float AvoidanceRangeMultiplier;
};
UENUM(BlueprintType)
enum class EHeadRotationType : uint8
{
None = 0 UMETA(DisplayName = "None"),
Search UMETA(DisplayName = "Search"),
Guard UMETA(DisplayName = "Guard"),
LoopSearch UMETA(DisplayName = "LoopSearch"),
Pause UMETA(DisplayName = "Pause"),
TurnToTarget UMETA(DisplayName = "TurnToTarget")
};
UENUM(BlueprintType)
enum class ENpcState : uint8
{
Default = 0 UMETA(DisplayName = "Default"),
Returning UMETA(DisplayName = "Returning"),
Doubt UMETA(DisplayName = "Doubt"),
Chase UMETA(DisplayName = "Chase"),
Attack UMETA(DisplayName = "Attack"),
Guard UMETA(DisplayName = "Guard"),
Hit UMETA(DisplayName = "Hit"),
Dead UMETA(DisplayName = "Dead"),
};
UENUM(BlueprintType)
enum class ENpcSpeedType : uint8
{
Walk = 0 UMETA(DisplayName = "Walk"),
Run UMETA(DisplayName = "Run"),
Stop UMETA(DisplayName = "Stop"),
};
UENUM(BlueprintType)
enum class EPatrolType : uint8
{
None = 0 UMETA(DisplayName = "None"),
Patrol UMETA(DisplayName = "Patrol"),
Search UMETA(DisplayName = "Search"),
SearchPatrol UMETA(DisplayName = "SearchPatrol"),
};
UENUM(BlueprintType)
enum class EDoubtState : uint8
{
None = 0 UMETA(DisplayName = "None"),
Increasing UMETA(DisplayName = "Increasing"),
Decreasing UMETA(DisplayName = "Decreasing"),
};
UENUM(BlueprintType)
enum class EVisionMode : uint8
{
None = 0 UMETA(DisplayName = "None"),
Cone UMETA(DisplayName = "Cone"),
Line UMETA(DisplayName = "Line"),
};
UENUM(BlueprintType)
enum class ENpcNormalAnimState : uint8
{
None = 0 UMETA(DisplayName = "None"),
Idle UMETA(DisplayName = "Idle"),
Walk UMETA(DisplayName = "Walk"),
Run UMETA(DisplayName = "Run"),
};
UENUM(BlueprintType)
enum class ENpcAbnormalAnimState : uint8
{
None = 0 UMETA(DisplayName = "None"),
HitBack UMETA(DisplayName = "HitBack"),
JumpBack UMETA(DisplayName = "JumpBack"),
FallDown UMETA(DisplayName = "FallDown"),
GetUp UMETA(DisplayName = "GetUp"),
Stun UMETA(DisplayName = "Stun"),
DeadStart UMETA(DisplayName = "DeadStart"),
DeadLoop UMETA(DisplayName = "DeadLoop"),
};
USTRUCT(Blueprintable)
struct FNpcSimpleRatio
{
GENERATED_BODY()
FNpcSimpleRatio() :
CurrentValue(0.f),
MaxValue(0.f)
{
}
UPROPERTY(EditAnywhere)
float CurrentValue;
UPROPERTY(EditAnywhere)
float MaxValue;
};
USTRUCT(Blueprintable)
struct FNpcEffectValue
{
GENERATED_BODY()
FNpcEffectValue() :
RemainTime(0.f),
MaxTime(0.f),
EffectValue(0.f)
{
}
UPROPERTY(EditAnywhere)
float RemainTime;
UPROPERTY(EditAnywhere)
float MaxTime;
UPROPERTY(EditAnywhere)
float EffectValue;
};
UCLASS()
class PROJECTT_API UNpcDataModel : public UObject
{
GENERATED_BODY()
};

View File

@ -0,0 +1,25 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "BaseDataPathLibrary.h"
namespace BaseDataPaths
{
const FString RootDir = "/Game/";
const FString SystemDir = RootDir + "System/";
const FString CoreDir = SystemDir + "Core/";
const FString EnvsDir = RootDir + "Envs/";
const FString CharactersDir = RootDir + "Characters/";
const FString LevelsDir = RootDir + "Levels/";
const FString UIDir = RootDir + "UI/";
const FString FXDir = RootDir + "FX/";
const FString SoundDir = RootDir + "Sound/";
const FString ResourcesDir = RootDir + "Resources/";
namespace Sound
{
const FString BGMDir = SoundDir + "BGM/";
const FString SFXDir = SoundDir + "SFX/";
}
}

View File

@ -0,0 +1,38 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "BaseDataPathLibrary.generated.h"
namespace BaseDataPaths
{
extern const FString RootDir;
extern const FString SystemDir;
extern const FString CoreDir;
extern const FString EnvsDir;
extern const FString CharactersDir;
extern const FString LevelsDir;
extern const FString UIDir;
extern const FString FXDir;
extern const FString SoundDir;
extern const FString ResourcesDir;
namespace Sound
{
extern const FString BGMDir;
extern const FString SFXDir;
}
}
UCLASS()
class PROJECTT_API UBaseDataPathLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintPure, meta = (ToolTip = "../Sound/"))
static FString GetSoundDir() { return BaseDataPaths::SoundDir; }
};

View File

@ -0,0 +1,16 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CoreDataPathLibrary.h"
#include "ProjectT/Data/Paths/BaseDataPathLibrary.h"
namespace CoreDataPaths
{
const FString DataDir = BaseDataPaths::CoreDir + "Data/";
namespace Data
{
const FString DatatableDir = DataDir + "DataTable/";
}
}

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "CoreDataPathLibrary.generated.h"
namespace CoreDataPaths
{
extern const FString DataDir;
namespace Data
{
extern const FString DatatableDir;
}
}
UCLASS()
class PROJECTT_API UCoreDataPathLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
};

View File

@ -0,0 +1,16 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "LevelDataPathLibrary.h"
#include "ProjectT/Data/Paths/BaseDataPathLibrary.h"
namespace LevelDataPaths
{
const FString MultiPlay = BaseDataPaths::LevelsDir + "MultiPlay/";
const FString SinglePlay = BaseDataPaths::LevelsDir + "SinglePlay/";
namespace Office
{
extern const FString SPOfficeDir = SinglePlay + "Office/";
}
}

View File

@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "LevelDataPathLibrary.generated.h"
namespace LevelDataPaths
{
extern const FString MultiPlay;
extern const FString SinglePlay;
namespace Office
{
extern const FString OfficeDir;
}
}
UCLASS()
class PROJECTT_API ULevelDataPathLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
};

View File

@ -0,0 +1,10 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UIDataPathLibrary.h"
#include "ProjectT/Data/Paths/BaseDataPathLibrary.h"
namespace UIDataPaths
{
const FString DebugDir = BaseDataPaths::UIDir + "Debug/";
}

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "UIDataPathLibrary.generated.h"
namespace UIDataPaths
{
extern const FString DebugDir;
}
UCLASS()
class PROJECTT_API UUIDataPathLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
};

View File

@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "PlayerInventoryModel.h"

View File

@ -0,0 +1,48 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ProjectT/Data/Gen/GenerateStructItem.h"
#include "UObject/Object.h"
#include "PlayerInventoryModel.generated.h"
USTRUCT(Blueprintable)
struct FPlayerGimmickSlotData
{
GENERATED_BODY()
FPlayerGimmickSlotData() :
ItemRowName("None"),
ItemCount(0)
{
}
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Item)
FName ItemRowName;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Item)
FItem ItemData;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Item)
int32 ItemCount;
};
USTRUCT(Blueprintable)
struct FPlayerSpendSlotData
{
GENERATED_BODY()
FPlayerSpendSlotData() :
ItemRowName("None")
{
}
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Item)
FName ItemRowName;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Item)
FItem ItemData;
};
UCLASS()
class PROJECTT_API UPlayerInventoryModel : public UObject
{
GENERATED_BODY()
};

View File

@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "PlayerDataModel.h"

View File

@ -0,0 +1,146 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "InputAction.h"
#include "UObject/Object.h"
#include "PlayerDataModel.generated.h"
UENUM(BlueprintType)
enum class EPlayerSkillState: uint8
{
None = 0 UMETA(DisplayName = "None"),
Start UMETA(DisplayName = "Start"),
Aim UMETA(DisplayName = "Aim"),
Activate UMETA(DispalyName = "Activate"),
Cancel UMETA(DIsplayeName = "Cancel"),
Release UMETA(DisplayName = "Release"),
Finish UMETA(DisplayName = "Finish")
};
USTRUCT(Blueprintable)
struct FPlayerActionTypes
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> AxisMoveAction;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> RunAction;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> MeleeAttackAction;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> SkillAction;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> InteractionAction;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> UseSlot1Action;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> UseSlot2Action;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> UseSlot3Action;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> MinimapAction;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> PauseAction;
};
USTRUCT(Blueprintable)
struct FPlayerChordedActionTypes
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> CtrlAction;
};
USTRUCT(Blueprintable)
struct FPlayerDebugActionTypes
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugToggleCheat;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugToggleInvincible;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugTogglePlayerDamage;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugTogglePlayerSpeed;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugToggleFrustum;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugToggleHitCollision;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugToggleTimeStop;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugToggleSlomo;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugCharacterSelect;
UPROPERTY(EditAnywhere, Category = Input)
TObjectPtr<UInputAction> DebugToggleCam;
};
USTRUCT(Blueprintable)
struct FPlayerSimpleRatio
{
GENERATED_BODY()
FPlayerSimpleRatio() :
CurrentValue(0.f),
MaxValue(0.f)
{
}
UPROPERTY(EditAnywhere)
float CurrentValue;
UPROPERTY(EditAnywhere)
float MaxValue;
};
USTRUCT(Blueprintable)
struct FPlayerEffectValue
{
GENERATED_BODY()
FPlayerEffectValue() :
RemainTime(0.f),
MaxTime(0.f),
EffectValue(0.f)
{
}
UPROPERTY(EditAnywhere)
float RemainTime;
UPROPERTY(EditAnywhere)
float MaxTime;
UPROPERTY(EditAnywhere)
float EffectValue;
};
UCLASS()
class PROJECTT_API UPlayerDataModel : public UObject
{
GENERATED_BODY()
};

View File

@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UserDataModel.h"

View File

@ -0,0 +1,134 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "UserDataModel.generated.h"
USTRUCT()
struct FSubQuestData
{
GENERATED_BODY()
FSubQuestData() {}
bool operator==(const FUserSaveData& Other) const
{
return (*this == Other);
}
bool operator!=(const FUserSaveData& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return true;
}
};
USTRUCT(BlueprintType)
struct FUnlockCharacterData
{
GENERATED_BODY()
FUnlockCharacterData() : bCleared(false) {}
FUnlockCharacterData(const FString& InRowName, bool InCleared = false) :
UnlockCharacterRowName(InRowName), bCleared(InCleared) {
}
bool operator==(const FUserSaveData& Other) const
{
return (*this == Other);
}
bool operator!=(const FUserSaveData& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return UnlockCharacterRowName.IsEmpty() && !bCleared;
}
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString UnlockCharacterRowName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bCleared;
};
USTRUCT(BlueprintType)
struct FStageData
{
GENERATED_BODY()
FStageData() : bCleared(false) {}
FStageData(const FString& InRowName, bool InCleared = false) :
StageRowName(InRowName), bCleared(InCleared) {
}
bool operator==(const FUserSaveData& Other) const
{
return (*this == Other);
}
bool operator!=(const FUserSaveData& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return StageRowName.IsEmpty() && !bCleared;
}
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString StageRowName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bCleared;
};
USTRUCT()
struct FUserSaveData
{
GENERATED_BODY()
FUserSaveData()
{
if(UnlockCharacterData.IsEmpty())
UnlockCharacterData.Push(FUnlockCharacterData(TEXT("200001"), true));
if(UnlockStageData.IsEmpty())
UnlockStageData.Push(FStageData(TEXT("100101"), true));
}
bool operator==(const FUserSaveData& Other) const
{
return (*this == Other);
}
bool operator!=(const FUserSaveData& Other) const
{
return !(*this == Other);
}
bool IsDefault() const
{
return SubQuestData.IsDefault() && UnlockStageData.IsEmpty() && UnlockCharacterData.IsEmpty();
}
UPROPERTY()
FSubQuestData SubQuestData;
UPROPERTY()
TArray<FStageData> UnlockStageData;
UPROPERTY()
TArray<FUnlockCharacterData> UnlockCharacterData;
UPROPERTY()
FString SelectedCharacterData;
};
UCLASS()
class PROJECTT_API UUserDataModel : public UObject
{
GENERATED_BODY()
};

View File

@ -0,0 +1,44 @@
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class ProjectT : ModuleRules
{
public ProjectT(ReadOnlyTargetRules Target) : base(Target)
{
PublicDependencyModuleNames.AddRange(new string[]
{
"Core",
"CoreUObject",
"Engine",
"InputCore",
"EnhancedInput",
"LevelSequence",
"MovieScene",
"Slate",
"SlateCore",
"UMG",
"Niagara",
"AIModule",
"ProceduralMeshComponent",
"NavigationSystem",
"MoviePlayer"
});
if (Target.bBuildEditor)
{
PrivateDependencyModuleNames.AddRange(new string[] {"UnrealEd","MaterialEditor", "LevelEditor" , "EditorUtilityModule"});
}
else
{
PrivateDependencyModuleNames.AddRange(new string[] { });
}
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}

View File

@ -0,0 +1,6 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ProjectT.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, ProjectT, "ProjectT" );

View File

@ -0,0 +1,75 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#define CONTENT_DIGIT 2
#define NOT_IMPLEMENTED_MSG(Str) UE_LOG(LogTemp, Warning, TEXT("Not Implemented %s() -> Line:%d -> Desc:%s"), TEXT(__FUNCTION__), __LINE__, TEXT(Str))
#define NOT_IMPLEMENTED() UE_LOG(LogTemp, Warning, TEXT("Not Implemented %s() -> Line:%d"), TEXT(__FUNCTION__), __LINE__)
#define CHECK_FREE(Str) Str.Equals("FREE")
#define NMT_CHECKF(Object) checkf((Object), TEXT("%s Is Fail. Please Check %s() -> Line:%d"), TEXT(#Object), TEXT(__FUNCTION__), __LINE__)
#define NMT_ENSURE(Object) ensureMsgf((Object), TEXT("%s Is Fail. Please Check %s() -> Line:%d"), TEXT(#Object), TEXT(__FUNCTION__), __LINE__)
#define NMT_MSG_CHECKF(Object, FormatStr, ...) checkf((Object), TEXT(FormatStr), ##__VA_ARGS__)
#define NMT_MSG_ENSURE(Object, FormatStr, ...) ensureMsgf((Object), TEXT(FormatStr), ##__VA_ARGS__)
#define JOIN_STRINGS(Delimiter, ...) (*(FString::Join<TArray<FString>>({__VA_ARGS__}, Delimiter)))
#define FROM_INT(Num) (*FString::FromInt(Num))
#define STRING_TO_INTEGER(Str) (FCString::Atoi(Str))
#define NAME_TO_INTEGER(Name) (FCString::Atoi(Name.ToString()))
#define SHOW_NMT_LOG 1
#define NMT_LOG_TYPE Warning
#ifndef IGN_PARAM
#define IGN_PARAM(X) { (void)X; }
#endif
#define NMT_LOGF(FormatStr, ...) \
if(SHOW_NMT_LOG) \
{ \
UE_LOG(LogTemp, NMT_LOG_TYPE, TEXT(FormatStr), ##__VA_ARGS__); \
}
#define NMT_LOG(FormatStr) \
if(SHOW_NMT_LOG) \
{ \
UE_LOG(LogTemp, NMT_LOG_TYPE, TEXT(FormatStr)); \
}
#ifdef __COUNTER__
#define NMT_DEBUG_PRINT(Duration, FormatStr, ...) \
if (GEngine) \
{ \
GEngine->AddOnScreenDebugMessage( \
uint64(sizeof(__FILE__) + sizeof(__func__) + __LINE__ + __COUNTER__), \
Duration, \
FColor::Orange, \
FString::Printf(TEXT(FormatStr), ##__VA_ARGS__), \
false, \
FVector2D(0.9, 0.9)); \
}
#define NMT_DEBUG_PRINT_ONCE(FormatStr, ...) \
NMT_DEBUG_PRINT(-1.f, FormatStr, ##__VA_ARGS__)
#define NMT_DEBUG_POS_PRINT(Duration, Position, FormatStr,...) \
if (GEngine) \
{ \
GEngine->AddOnScreenDebugMessage( \
uint64(sizeof(__FILE__) + sizeof(__func__) + __LINE__ + __COUNTER__), \
Duration, \
FColor::Orange, \
FString::Printf(TEXT(FormatStr), ##__VA_ARGS__), \
false, \
Position \
); \
}
#define NMT_DEBUG_POS_PRINT_ONCE(Position, FormatStr, ...) \
NMT_DEBUG_POS_PRINT(-1.f, Position, FormatStr)
#endif

View File

@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AbnormalAnimEnd.h"
#include "ProjectT/System/SinglePlay/Characters/NPC/SPNpcAgent.h"
void UAbnormalAnimEnd::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
Super::Notify(MeshComp, Animation, EventReference);
ASPNpcAgent* AgentNpc = Cast<ASPNpcAgent>(MeshComp->GetOwner());
if (AgentNpc)
{
AgentNpc->DetermineNextStateAfterAbnormal();
}
}

View File

@ -0,0 +1,16 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h"
#include "AbnormalAnimEnd.generated.h"
UCLASS()
class PROJECTT_API UAbnormalAnimEnd : public UAnimNotify
{
GENERATED_BODY()
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
};

View File

@ -0,0 +1,21 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "NonInputAnimEnd.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
#include "ProjectT/System/Core/Characters/Player/Animations/AnimInstance/PlayerCharacterAnimInstance.h"
void UNonInputAnimEnd::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation,
const FAnimNotifyEventReference& EventReference)
{
Super::Notify(MeshComp, Animation, EventReference);
ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(MeshComp->GetOwner());
if(LocPlayerCharacter)
{
UPlayerCharacterAnimInstance* LocPlayerAnimInstance;
LocPlayerCharacter->GetAnimInstance(LocPlayerAnimInstance);
LocPlayerAnimInstance->NonInputAnimFinished();
return;
}
}

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h"
#include "NonInputAnimEnd.generated.h"
/**
*
*/
UCLASS()
class PROJECTT_API UNonInputAnimEnd : public UAnimNotify
{
GENERATED_BODY()
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
};

View File

@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SkillHitEnabled.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
#include "ProjectT/System/Core/Characters/Skill/CoreSkill.h"
#include "ProjectT/System/SinglePlay/Characters/NPC/SPNpcAgent.h"
void USkillHitEnabled::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation,
const FAnimNotifyEventReference& EventReference)
{
Super::Notify(MeshComp, Animation, EventReference);
if(const ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(MeshComp->GetOwner()))
{
ACoreSkill* LocCurrentSkill;
LocPlayerCharacter->GetCurrentSkill(LocCurrentSkill);
if (LocCurrentSkill)
LocCurrentSkill->SkillHitEnable(true);
return;
}
if(const ASPNpcAgent* LocASPNpcAgent = Cast<ASPNpcAgent>(MeshComp->GetOwner()))
{
ACoreSkill* LocCurrentSkill = LocASPNpcAgent->GetCurrentSkill();
if (LocCurrentSkill)
LocCurrentSkill->SkillHitEnable(true);
return;
}
if(ACoreSkill* LocACoreSkill = Cast<ACoreSkill>(MeshComp->GetOwner()))
{
LocACoreSkill->SkillObjectHitEnable(true);
}
}

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h"
#include "SkillHitEnabled.generated.h"
/**
*
*/
UCLASS()
class PROJECTT_API USkillHitEnabled : public UAnimNotify
{
GENERATED_BODY()
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
};

View File

@ -0,0 +1,56 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SkillFXEnabledState.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
#include "ProjectT/System/Core/Characters/Skill/CoreSkill.h"
#include "ProjectT/System/SinglePlay/Characters/NPC/SPNpcAgent.h"
void USkillFXEnabledState::NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation,
float TotalDuration, const FAnimNotifyEventReference& EventReference)
{
Super::NotifyBegin(MeshComp, Animation, TotalDuration, EventReference);
ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(MeshComp->GetOwner());
if(LocPlayerCharacter)
{
ACoreSkill* LocCurrentSkill;
LocPlayerCharacter->GetCurrentSkill(LocCurrentSkill);
if (LocCurrentSkill)
LocCurrentSkill->SkillFXEnable(true, FXIndex);
return;
}
ASPNpcAgent* LocASPNpcAgent = Cast<ASPNpcAgent>(MeshComp->GetOwner());
if(LocASPNpcAgent)
{
ACoreSkill* LocCurrentSkill = LocASPNpcAgent->GetCurrentSkill();
if (LocCurrentSkill)
LocCurrentSkill->SkillFXEnable(true, FXIndex);
return;
}
}
void USkillFXEnabledState::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation,
const FAnimNotifyEventReference& EventReference)
{
Super::NotifyEnd(MeshComp, Animation, EventReference);
ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(MeshComp->GetOwner());
if(LocPlayerCharacter)
{
ACoreSkill* LocCurrentSkill;
LocPlayerCharacter->GetCurrentSkill(LocCurrentSkill);
if (LocCurrentSkill)
LocCurrentSkill->SkillFXEnable(false, FXIndex);
return;
}
ASPNpcAgent* LocASPNpcAgent = Cast<ASPNpcAgent>(MeshComp->GetOwner());
if(LocASPNpcAgent)
{
ACoreSkill* LocCurrentSkill = LocASPNpcAgent->GetCurrentSkill();
if (LocCurrentSkill)
LocCurrentSkill->SkillFXEnable(false, FXIndex);
return;
}
}

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotifyState.h"
#include "SkillFXEnabledState.generated.h"
/**
*
*/
UCLASS()
class PROJECTT_API USkillFXEnabledState : public UAnimNotifyState
{
GENERATED_BODY()
virtual void NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration, const FAnimNotifyEventReference& EventReference) override;
virtual void NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
protected:
UPROPERTY(EditAnywhere)
int32 FXIndex = 0;
};

View File

@ -0,0 +1,59 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SkillHitEnabledState.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
#include "ProjectT/System/Core/Characters/Skill/CoreSkill.h"
#include "ProjectT/System/SinglePlay/Characters/NPC/SPNpcAgent.h"
void USkillHitEnabledState::NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation,
float TotalDuration, const FAnimNotifyEventReference& EventReference)
{
Super::NotifyBegin(MeshComp, Animation, TotalDuration, EventReference);
ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(MeshComp->GetOwner());
if(LocPlayerCharacter)
{
ACoreSkill* LocCurrentSkill;
LocPlayerCharacter->GetCurrentSkill(LocCurrentSkill);
if(LocCurrentSkill)
{
LocCurrentSkill->SkillHitEnable(true);
}
return;
}
ASPNpcAgent* LocASPNpcAgent = Cast<ASPNpcAgent>(MeshComp->GetOwner());
if(LocASPNpcAgent)
{
ACoreSkill* LocCurrentSkill = LocASPNpcAgent->GetCurrentSkill();
if (LocCurrentSkill)
LocCurrentSkill->SkillHitEnable(true);
return;
}
}
void USkillHitEnabledState::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
{
Super::NotifyEnd(MeshComp, Animation, EventReference);
ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(MeshComp->GetOwner());
if(LocPlayerCharacter)
{
ACoreSkill* LocCurrentSkill;
LocPlayerCharacter->GetCurrentSkill(LocCurrentSkill);
if (LocCurrentSkill)
{
LocCurrentSkill->SkillHitEnable(false);
}
return;
}
ASPNpcAgent* LocASPNpcAgent = Cast<ASPNpcAgent>(MeshComp->GetOwner());
if(LocASPNpcAgent)
{
ACoreSkill* LocCurrentSkill = LocASPNpcAgent->GetCurrentSkill();
if (LocCurrentSkill)
LocCurrentSkill->SkillHitEnable(false);
return;
}
}

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotifyState.h"
#include "SkillHitEnabledState.generated.h"
/**
*
*/
UCLASS()
class PROJECTT_API USkillHitEnabledState : public UAnimNotifyState
{
GENERATED_BODY()
virtual void NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration, const FAnimNotifyEventReference& EventReference) override;
virtual void NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
};

View File

@ -0,0 +1,258 @@
#include "CombatCharacter.h"
#include "Components/CapsuleComponent.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/Data/Gen/GenerateEnumContentType.h"
#include "ProjectT/Data/Gen/GenerateEnumDataTableKey.h"
#include "ProjectT/Data/Gen/GenerateStructCharacterMeshSet.h"
#include "ProjectT/Data/Gen/GenerateStructEnemyNPC.h"
#include "ProjectT/Data/Gen/GenerateStructMeshList.h"
#include "ProjectT/Data/Gen/GenerateStructPlayerCharacter.h"
#include "ProjectT/Data/Gen/GenerateStructSocketList.h"
#include "ProjectT/System/Core/Common/AssetUtilsLibrary.h"
#include "ProjectT/System/Core/Common/GlobalUtilsLibrary.h"
class CharacterDataLoader
{
public:
static void From(const FName& RowName, FName& OutMeshRowName, FCharacterMeshSet& OutMeshList, const FTableRowBase*& OutContentData)
{
FName FoundMeshRowName;
EContentType NewContentType = UGlobalUtilsLibrary::GetContentTypeFromIndex(RowName);
UDataTable* DataTable = nullptr;
switch(NewContentType)
{
case EContentType::PlayerCharacter:
{
DataTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::PlayerCharacter);
FPlayerCharacter* CharacterDataRow = DataTable->FindRow<FPlayerCharacter>(RowName, TEXT("Not Found FPlayerCharacter"));
if(!NMT_ENSURE(CharacterDataRow)) return;
FoundMeshRowName = FROM_INT(CharacterDataRow->iCharMeshSetId);
OutContentData = CharacterDataRow;
break;
}
case EContentType::EnemyNpc:
{
DataTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::EnemyNpc);
FEnemyNpc* CharacterDataRow = DataTable->FindRow<FEnemyNpc>(RowName, TEXT("Not Found FEnemyNPC"));
if(!NMT_ENSURE(CharacterDataRow)) return;
FoundMeshRowName = FROM_INT(CharacterDataRow->iNpcMeshSetId);
OutContentData = CharacterDataRow;
break;
}
default: return;
}
DataTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::CharacterMeshSet);
if(FCharacterMeshSet* RowData = DataTable->FindRow<FCharacterMeshSet>(FoundMeshRowName, TEXT("FCharacterMeshSet")))
{
OutMeshList = *RowData;
OutMeshRowName = FoundMeshRowName;
}
}
};
ACombatCharacter::ACombatCharacter() :
AccessoryMeshComponent(nullptr),
WeaponStaticComponent(nullptr),
WeaponDynamicComponent(nullptr),
DefaultBodyMesh(nullptr)
{
GetCapsuleComponent()->SetCapsuleHalfHeight(50.0f);
GetCapsuleComponent()->SetCapsuleRadius(20.0f);
GetMesh()->SetRelativeLocation(FVector(0.0f, 0.0f, -52.0f));
AccessoryMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("AccessoryMeshComponent"));
WeaponStaticComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("WeaponStaticComponent"));
WeaponDynamicComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("WeaponDynamicComponent"));
NMT_CHECKF(AccessoryMeshComponent && WeaponStaticComponent && WeaponDynamicComponent);
UGlobalUtilsLibrary::EnableComponent(AccessoryMeshComponent, false);
UGlobalUtilsLibrary::EnableComponent(WeaponStaticComponent, false);
UGlobalUtilsLibrary::EnableComponent(WeaponDynamicComponent, false);
}
void ACombatCharacter::PostLoad()
{
Super::PostLoad();
}
void ACombatCharacter::OnConstruction(const FTransform& Transform)
{
Super::OnConstruction(Transform);
#if WITH_EDITOR
const FString LabelRowName = *GetActorLabel();
if(LabelRowName.IsNumeric()) ApplyCharacterConfiguration(*LabelRowName);
#endif
}
EContentType ACombatCharacter::GetContentType_Implementation()
{
return IContentType::GetContentType_Implementation();
}
FString ACombatCharacter::GetContentTypeNumber_Implementation()
{
return IContentType::GetContentTypeNumber_Implementation();
}
void ACombatCharacter::BeginPlay()
{
Super::BeginPlay();
#if WITH_EDITOR
const FString LabelRowName = *GetActorLabel();
if(LabelRowName.IsNumeric()) ApplyCharacterConfiguration(*LabelRowName);
else if(!CharacterRowName.IsNone() && CharacterRowName.ToString().IsNumeric()) ApplyCharacterConfiguration(CharacterRowName);
#endif
GetCapsuleComponent()->OnClicked.AddUniqueDynamic(this, &ACombatCharacter::ExecuteClickedEvent);
GetCapsuleComponent()->OnBeginCursorOver.AddUniqueDynamic(this, &ACombatCharacter::ExecuteBeginCursorOverEvent);
GetCapsuleComponent()->OnEndCursorOver.AddUniqueDynamic(this, &ACombatCharacter::ExecuteEndCursorOverEvent);
}
#if WITH_EDITOR
void ACombatCharacter::ApplyCharacterConfiguration(const FName& RowName)
{
if(RowName.IsNone())
{
RestoreCharacterSet();
RestoreCharacterData();
return;
}
const EContentType NewContentType = UGlobalUtilsLibrary::GetContentTypeFromIndex(RowName);
if(EContentType::PlayerCharacter != NewContentType && EContentType::EnemyNpc != NewContentType)
{
RestoreCharacterSet();
RestoreCharacterData();
return;
}
FName MeshSetRowName;
FCharacterMeshSet NewMeshSet;
const FTableRowBase* CharacterData = nullptr;
CharacterDataLoader::From(RowName, MeshSetRowName, NewMeshSet, CharacterData);
if(MeshSetRowName.IsNone())
{
RestoreCharacterSet();
return;
}
if(ApplyCharacterSet(MeshSetRowName))
{
CurrentMeshSet = NewMeshSet;
CharacterRowName = RowName;
}
else RestoreCharacterSet();
if(CharacterData) ApplyCharacterData(CharacterData);
}
bool ACombatCharacter::ApplyCharacterSet(const FName& RowName)
{
UDataTable* CMSTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::CharacterMeshSet);
FCharacterMeshSet* CMSData = CMSTable->FindRow<FCharacterMeshSet>(RowName, TEXT("FCharacterMeshSet"));
if(!CMSData) return false;
UDataTable* MLSTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::MeshList);
FMeshList* BodyData = MLSTable->FindRow<FMeshList>(FROM_INT(CMSData->iBodyMeshId), TEXT("FMeshList"));
if(!BodyData) return false;
USkeletalMesh* BodyMesh = UAssetUtilsLibrary::GetSkeletalMeshFromPath(BodyData->sMeshPath);
if(!BodyMesh) return false;
GetMesh()->SetSkeletalMesh(BodyMesh);
FMeshList* WeaponData = nullptr;
if(CMSData->iWeaponMeshId != 0) WeaponData = MLSTable->FindRow<FMeshList>(FROM_INT(CMSData->iWeaponMeshId), TEXT("FMeshList"));
/**
* NOTE: Weapon Data
*/
if(!WeaponData) return true;
if(!CHECK_FREE(WeaponData->sMeshPath))
{
UMeshComponent* WeaponComponent = nullptr;
FString ScriptType = UGlobalUtilsLibrary::GetScriptTypeByRefPath(WeaponData->sMeshPath);
if(ScriptType.Equals(TEXT("StaticMesh")))
{
UStaticMesh* WeaponMesh = UAssetUtilsLibrary::GetStaticMeshFromPath(WeaponData->sMeshPath);
WeaponStaticComponent->SetStaticMesh(WeaponMesh);
UGlobalUtilsLibrary::EnableComponent(WeaponStaticComponent, true);
WeaponComponent = WeaponStaticComponent;
}
else if(ScriptType.Equals(TEXT("SkeletalMesh")))
{
USkeletalMesh* WeaponMesh = UAssetUtilsLibrary::GetSkeletalMeshFromPath(WeaponData->sMeshPath);
WeaponDynamicComponent->SetSkeletalMesh(WeaponMesh);
UGlobalUtilsLibrary::EnableComponent(WeaponDynamicComponent, true);
WeaponComponent = WeaponDynamicComponent;
}
else NMT_MSG_CHECKF(0, "%s: type is not supported", *WeaponData->sMeshPath);
CMSData->iWeaponSocketId;
UDataTable* SocketTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::SocketList);
FSocketList* SocketData = SocketTable->FindRow<FSocketList>(FROM_INT(CMSData->iWeaponSocketId), TEXT("FSocketList"));
if(CHECK_FREE(SocketData->sSocketName))
{
NMT_MSG_ENSURE(0, "Socket Name Is FREE [%s][%s]", FROM_INT(CMSData->iWeaponSocketId), *SocketData->sSocketName);
return true;
}
WeaponComponent->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetIncludingScale, *SocketData->sSocketName);
}
return true;
}
void ACombatCharacter::ApplyCharacterData(const FTableRowBase* RowData)
{
NMT_MSG_ENSURE(0, "Function should be overridden in the child class.");
}
void ACombatCharacter::RestoreCharacterData()
{
ApplyCharacterData(nullptr);
}
void ACombatCharacter::RestoreCharacterSet()
{
AccessoryMeshComponent->DetachFromComponent(FDetachmentTransformRules::KeepWorldTransform);
UGlobalUtilsLibrary::EnableComponent(AccessoryMeshComponent, false);
WeaponStaticComponent->DetachFromComponent(FDetachmentTransformRules::KeepWorldTransform);
UGlobalUtilsLibrary::EnableComponent(WeaponStaticComponent, false);
WeaponDynamicComponent->DetachFromComponent(FDetachmentTransformRules::KeepWorldTransform);
UGlobalUtilsLibrary::EnableComponent(WeaponDynamicComponent, false);
FString LocDefaultSKMeshPath = "/Script/Engine.SkeletalMesh'/Game/Characters/Pyro/Assets/SK_Pyro_Invalid.SK_Pyro_Invalid'";
DefaultBodyMesh = UAssetUtilsLibrary::GetSkeletalMeshFromPath(LocDefaultSKMeshPath);
if(DefaultBodyMesh != nullptr)
{
GetMesh()->SetSkeletalMesh(DefaultBodyMesh);
}
CurrentMeshSet = FCharacterMeshSet();
CharacterRowName = TEXT("None");
}
#endif
void ACombatCharacter::Respawn()
{
NOT_IMPLEMENTED();
}
void ACombatCharacter::ExecuteClickedEvent(UPrimitiveComponent* InTouchedComponent, FKey InButtonPressed)
{
Super::ExecuteClickedEvent(InTouchedComponent, InButtonPressed);
}
void ACombatCharacter::ExecuteBeginCursorOverEvent(UPrimitiveComponent* InTouchedComponent)
{
Super::ExecuteBeginCursorOverEvent(InTouchedComponent);
}
void ACombatCharacter::ExecuteEndCursorOverEvent(UPrimitiveComponent* InTouchedComponent)
{
Super::ExecuteEndCursorOverEvent(InTouchedComponent);
}

View File

@ -0,0 +1,69 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "CoreCharacter.h"
#include "ProjectT/System/Core/Characters/CoreCharacter.h"
#include "ProjectT/Data/Gen/GenerateStructCharacterMeshSet.h"
#include "ProjectT/System/Core/Interfaces/ContentType.h"
#include "ProjectT/System/Core/Interfaces/ObjectInteractionControl.h"
#include "CombatCharacter.generated.h"
class USkeletalMesh;
class UStaticMeshComponent;
UCLASS()
class PROJECTT_API ACombatCharacter : public ACoreCharacter, public IContentType
{
GENERATED_BODY()
public:
ACombatCharacter();
virtual void PostLoad() override;
virtual void OnConstruction(const FTransform& Transform) override;
virtual EContentType GetContentType_Implementation() override;
virtual FString GetContentTypeNumber_Implementation() override;
void GetWeaponStaticComponent(TObjectPtr<UStaticMeshComponent>& OutStaticWeapon) const { OutStaticWeapon = WeaponStaticComponent; }
protected:
virtual void BeginPlay() override;
#if WITH_EDITOR
virtual void ApplyCharacterConfiguration(const FName& RowName);
virtual bool ApplyCharacterSet(const FName& RowName);
virtual void ApplyCharacterData(const FTableRowBase* RowData);
void RestoreCharacterSet();
void RestoreCharacterData();
#endif
virtual void Respawn();
virtual void ExecuteClickedEvent(UPrimitiveComponent* InTouchedComponent, FKey InButtonPressed) override;
virtual void ExecuteBeginCursorOverEvent(UPrimitiveComponent* InTouchedComponent) override;
virtual void ExecuteEndCursorOverEvent(UPrimitiveComponent* InTouchedComponent) override;
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Design|CharacterSet")
TObjectPtr<UStaticMeshComponent> AccessoryMeshComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Design|CharacterSet")
TObjectPtr<UStaticMeshComponent> WeaponStaticComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Design|CharacterSet")
TObjectPtr<USkeletalMeshComponent> WeaponDynamicComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Design|CharacterSet")
FName CharacterRowName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Design|CharacterSet", meta = (AllowPrivateAccess = "true"))
FCharacterMeshSet CurrentMeshSet;
UPROPERTY()
TObjectPtr<USkeletalMesh> DefaultBodyMesh;
private:
UPROPERTY()
FName PrevCharacterRowName;
};

View File

@ -0,0 +1,37 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CoreCharacter.h"
#include "ProjectT/ProjectT.h"
ACoreCharacter::ACoreCharacter()
{
PrimaryActorTick.bCanEverTick = true;
}
void ACoreCharacter::BeginPlay()
{
Super::BeginPlay();
}
void ACoreCharacter::ExecuteClickedEvent(UPrimitiveComponent* InTouchedComponent, FKey InButtonPressed)
{
NOT_IMPLEMENTED();
}
void ACoreCharacter::ExecuteBeginCursorOverEvent(UPrimitiveComponent* InTouchedComponent)
{
NOT_IMPLEMENTED();
}
void ACoreCharacter::ExecuteEndCursorOverEvent(UPrimitiveComponent* InTouchedComponent)
{
NOT_IMPLEMENTED();
}
void ACoreCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -0,0 +1,33 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "CoreCharacter.generated.h"
UCLASS()
class PROJECTT_API ACoreCharacter : public ACharacter
{
GENERATED_BODY()
public:
ACoreCharacter();
protected:
virtual void BeginPlay() override;
UFUNCTION()
virtual void ExecuteClickedEvent(UPrimitiveComponent* InTouchedComponent, FKey InButtonPressed);
UFUNCTION()
virtual void ExecuteBeginCursorOverEvent(UPrimitiveComponent* InTouchedComponent);
UFUNCTION()
virtual void ExecuteEndCursorOverEvent(UPrimitiveComponent* InTouchedComponent);
public:
virtual void Tick(float DeltaTime) override;
};

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "BlackboardKeyLibrary.h"
namespace NpcBaseKeys
{
const FName TargetActor = FName("TargetActor");
const FName TargetLocation = FName("TargetLocation");
const FName TargetDir = FName("TargetDir");
const FName ReturnLocation = FName("ReturnLocation");
const FName CurrentState = FName("CurrentState");
const FName bCanAttack = FName("bCanAttack");
const FName bCanRotateWhileAttack = FName("bCanRotateWhileAttack");
const FName CurrentDoubtState = FName("CurrentDoubtState");
namespace PatrolKeys
{
FName bMoveReverse = FName("bMoveReverse");
FName PatrolType = FName("PatrolType");
}
}

View File

@ -0,0 +1,63 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "BlackboardKeyLibrary.generated.h"
namespace NpcBaseKeys
{
extern const FName TargetActor;
extern const FName TargetLocation;
extern const FName TargetDir;
extern const FName ReturnLocation;
extern const FName CurrentState;
extern const FName bCanAttack;
extern const FName bCanRotateWhileAttack;
extern const FName CurrentDoubtState;
namespace PatrolKeys
{
extern FName bMoveReverse;
extern FName PatrolType;
}
}
UCLASS()
class PROJECTT_API UBlackboardKeyLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintPure, meta = (ToolTip = "TargetActor"))
static FName GetTargetActorKey() { return NpcBaseKeys::TargetActor; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "TargetLocation"))
static FName GetTargetLocationKey() { return NpcBaseKeys::TargetLocation; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "TargetDir"))
static FName GetTargetDirKey() { return NpcBaseKeys::TargetDir; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "ReturnLocation"))
static FName GetReturnLocationKey() { return NpcBaseKeys::ReturnLocation; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "NpcState"))
static FName GetCurrentStateKey() { return NpcBaseKeys::CurrentState; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "CanAttack"))
static FName GetCanAttack() { return NpcBaseKeys::bCanAttack; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "CanRotateWhileAttack"))
static FName GetCanRotateWhileAttack() { return NpcBaseKeys::bCanRotateWhileAttack; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "CurrentDoubtState"))
static FName GetCurrentDoubtState() { return NpcBaseKeys::CurrentDoubtState; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "bMoveReverse"))
static FName GetMoveReverseKey() { return NpcBaseKeys::PatrolKeys::bMoveReverse; }
UFUNCTION(BlueprintPure, meta = (ToolTip = "PatrolType"))
static FName GetPatrolTypeKey() { return NpcBaseKeys::PatrolKeys::PatrolType; }
};

View File

@ -0,0 +1,154 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AIControllerBase.h"
#include "BrainComponent.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BlackboardData.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/System/Core/Interfaces/AISettings.h"
#include "ProjectT/Data/Npc/NpcDataModel.h"
#include "ProjectT/System/Core/Characters/NPC/AI/Blackboard/BlackboardKeyLibrary.h"
AAIControllerBase::AAIControllerBase(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer),
bCanDetect(true)
{
}
void AAIControllerBase::BeginPlay()
{
Super::BeginPlay();
}
class UBlackboardComponent* AAIControllerBase::GetCheckedBlackboardComponent()
{
UBlackboardComponent* BBC = GetBlackboardComponent();
NMT_CHECKF(BBC)
return BBC;
}
void AAIControllerBase::PostInitializeComponents()
{
Super::PostInitializeComponents();
}
void AAIControllerBase::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
SetGenericTeamId(FGenericTeamId(0));
}
void AAIControllerBase::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void AAIControllerBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
OnDetectTarget.Clear();
OnForgetTarget.Clear();
}
void AAIControllerBase::UpdateTargetInfo(AActor* InTarget)
{
GetCheckedBlackboardComponent()->SetValueAsObject(UBlackboardKeyLibrary::GetTargetActorKey(), InTarget);
if(InTarget != nullptr)
{
UpdateTargetLocation(InTarget->GetActorLocation());
UpdateTargetDirection(InTarget);
OnDetectTarget.Broadcast();
}
else
{
OnForgetTarget.Broadcast();
}
}
void AAIControllerBase::UpdateTargetLocation(const FVector& InLocation)
{
GetCheckedBlackboardComponent()->SetValueAsVector(UBlackboardKeyLibrary::GetTargetLocationKey(), InLocation);
}
void AAIControllerBase::UpdateTargetDirection(const AActor* InTarget)
{
FVector Dir = InTarget->GetActorLocation() - GetPawn()->GetActorLocation();
Dir.Normalize();
GetCheckedBlackboardComponent()->SetValueAsVector(UBlackboardKeyLibrary::GetTargetDirKey(), Dir);
}
void AAIControllerBase::UpdateTargetDirection(const FVector& InTargetDirection)
{
GetCheckedBlackboardComponent()->SetValueAsVector(UBlackboardKeyLibrary::GetTargetDirKey(), InTargetDirection);
}
void AAIControllerBase::ChangeNpcStateKey(const ENpcState InState)
{
GetCheckedBlackboardComponent()->SetValueAsEnum(UBlackboardKeyLibrary::GetCurrentStateKey(), static_cast<uint8>(InState));
}
void AAIControllerBase::StartAI()
{
NMT_CHECKF(BrainComponent)
BrainComponent->StartLogic();
}
void AAIControllerBase::StopAI(const FString& Reason, const bool bControlPerception)
{
NMT_CHECKF(BrainComponent)
BrainComponent->StopLogic(Reason);
}
AActor* AAIControllerBase::GetTargetActor() const
{
return Cast<AActor>(GetBlackboardComponent()->GetValueAsObject(UBlackboardKeyLibrary::GetTargetActorKey()));
}
void AAIControllerBase::ActivateBehaviorTree(APawn* InPawn)
{
if(InPawn->GetClass()->ImplementsInterface(UAISettings::StaticClass()))
{
UBlackboardData* BB = IAISettings::Execute_GetBlackboardData(InPawn);
BehaviorTree = IAISettings::Execute_GetBehaviorTree(InPawn);
if(!NMT_ENSURE(BB && BehaviorTree)) return;
UBlackboardComponent* BlackboardComponent = Blackboard.Get();
if(UseBlackboard(BB, BlackboardComponent))
{
RunBehaviorTree(BehaviorTree);
}
}
}
void AAIControllerBase::UpdateReturnLocation(const FVector& InLocation)
{
GetCheckedBlackboardComponent()->SetValueAsVector(UBlackboardKeyLibrary::GetReturnLocationKey(), InLocation);
}
void AAIControllerBase::UpdateNextPatrolType(const EPatrolType InPatrolType)
{
GetCheckedBlackboardComponent()->SetValueAsEnum(UBlackboardKeyLibrary::GetPatrolTypeKey(), static_cast<uint8>(InPatrolType));
}
void AAIControllerBase::UpdateDoubtState(const EDoubtState InDoubtState)
{
GetCheckedBlackboardComponent()->SetValueAsEnum(UBlackboardKeyLibrary::GetCurrentDoubtState(), static_cast<uint8>(InDoubtState));
}
void AAIControllerBase::SetEnableAttack(const bool InbEnable)
{
GetCheckedBlackboardComponent()->SetValueAsBool(UBlackboardKeyLibrary::GetCanAttack(), InbEnable);
}
void AAIControllerBase::SetCanRotateWhileAttack(const bool InbEnable)
{
GetCheckedBlackboardComponent()->SetValueAsBool(UBlackboardKeyLibrary::GetCanRotateWhileAttack(), InbEnable);
}

View File

@ -0,0 +1,76 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Runtime/AIModule/Classes/AIController.h"
#include "ProjectT/Data/Npc/NpcDataModel.h"
#include "AIControllerBase.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDetectTarget);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnForgetTarget);
enum class EEffectSubTypes : uint8;
UCLASS()
class PROJECTT_API AAIControllerBase : public AAIController
{
GENERATED_BODY()
public:
AAIControllerBase(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
virtual void PostInitializeComponents() override;
virtual void OnPossess(APawn* InPawn) override;
virtual void Tick(float DeltaTime) override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
UFUNCTION(BlueprintCallable)
void UpdateTargetInfo(AActor* InTarget);
UFUNCTION(BlueprintCallable)
void ChangeNpcStateKey(const ENpcState InState);
UFUNCTION(BlueprintCallable)
virtual void StartAI();
UFUNCTION(BlueprintCallable)
virtual void StopAI(const FString& Reason, const bool bControlPerception = true);
class AActor* GetTargetActor() const;
FORCEINLINE void SetCanDetect(bool InbCanDetect) { bCanDetect = InbCanDetect; }
FORCEINLINE bool GetCanDetect() const { return bCanDetect; }
virtual void ActivateBehaviorTree(APawn* InPawn);
void UpdateTargetLocation(const FVector& InLocation);
void UpdateTargetDirection(const AActor* InTarget);
void UpdateTargetDirection(const FVector& InTargetDirection);
void UpdateReturnLocation(const FVector& InLocation);
void UpdateNextPatrolType(const EPatrolType InPatrolType);
void UpdateDoubtState(const EDoubtState InDoubtState);
void SetEnableAttack(const bool InbEnable);
void SetCanRotateWhileAttack(const bool InbEnable);
protected:
virtual void BeginPlay() override;
class UBlackboardComponent* GetCheckedBlackboardComponent();
protected:
UPROPERTY(BlueprintAssignable)
FOnDetectTarget OnDetectTarget;
UPROPERTY(BlueprintAssignable)
FOnForgetTarget OnForgetTarget;
UPROPERTY()
TObjectPtr<class UCrowdFollowingComponent> CrowdFollowingComponent;
uint8 bCanDetect : 1;
private:
UPROPERTY()
TObjectPtr<class UBehaviorTree> BehaviorTree;
};

View File

@ -0,0 +1,44 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AIHearingController.h"
#include "Perception/AISenseConfig_Hearing.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/System/Core/Interfaces/AISettings.h"
AAIHearingController::AAIHearingController(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = true;
HearingConfig = AddHearingConfig();
}
void AAIHearingController::BeginPlay()
{
Super::BeginPlay();
}
void AAIHearingController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
NMT_CHECKF(HearingConfig);
NMT_CHECKF(GetPawn());
if(GetPawn()->GetClass()->ImplementsInterface(UAISettings::StaticClass()))
{
FHearingInfo HearingInfo = IAISettings::Execute_GetHearingInfo(InPawn);
HearingConfig->HearingRange = HearingInfo.HearingRange;
HearingConfig->SetMaxAge(HearingInfo.HearingMaxAge);
}
UpdatePerceptionSystem();
}
void AAIHearingController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -0,0 +1,27 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AIPerceptionController.h"
#include "AIHearingController.generated.h"
UCLASS()
class PROJECTT_API AAIHearingController : public AAIPerceptionController
{
GENERATED_BODY()
public:
AAIHearingController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
protected:
virtual void BeginPlay() override;
public:
virtual void OnPossess(APawn* InPawn) override;
virtual void Tick(float DeltaTime) override;
public:
UPROPERTY(EditAnywhere, Category = "AIPerception")
class UAISenseConfig_Hearing* HearingConfig;
};

View File

@ -0,0 +1,185 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AIPerceptionController.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Navigation/CrowdFollowingComponent.h"
#include "Perception/AIPerceptionComponent.h"
#include "Perception/AISenseConfig_Hearing.h"
#include "Perception/AISenseConfig_Sight.h"
#include "Perception/AISense_Sight.h"
#include "ProjectT/System/Core/Characters/NPC/AI/Blackboard/BlackboardKeyLibrary.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
#include "ProjectT/System/Core/Interfaces/AISettings.h"
#include "ProjectT/System/SinglePlay/Characters/NPC/SPNpcAgent.h"
AAIPerceptionController::AAIPerceptionController(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
{
SetPerceptionComponent(*CreateOptionalDefaultSubobject<UAIPerceptionComponent>(TEXT("AIPerceptionComponent")));
}
void AAIPerceptionController::BeginPlay()
{
Super::BeginPlay();
if(ASPNpcAgent* NpcAgent = Cast<ASPNpcAgent>(GetPawn()))
{
CrowdFollowingComponent = Cast<UCrowdFollowingComponent>(GetPathFollowingComponent());
NMT_CHECKF(CrowdFollowingComponent);
SetupCrowdSettings(NpcAgent->CrowdSettingsInfo);
}
}
void AAIPerceptionController::SetupCrowdSettings(const FCrowdSettingsInfo& InCrowdSettings) const
{
if(!NMT_ENSURE(CrowdFollowingComponent))
return;
if(InCrowdSettings.bUseCrowdSeparation)
{
CrowdFollowingComponent->SetCrowdSeparation(InCrowdSettings.bUseCrowdSeparation);
CrowdFollowingComponent->SetCrowdSeparationWeight(InCrowdSettings.SeparationWeight);
CrowdFollowingComponent->SetCrowdAvoidanceRangeMultiplier(InCrowdSettings.AvoidanceRangeMultiplier);
CrowdFollowingComponent->SetCrowdRotateToVelocity(false);
}
}
void AAIPerceptionController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
}
void AAIPerceptionController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void AAIPerceptionController::StartAI()
{
Super::StartAI();
SetPerceptionActive(true);
}
void AAIPerceptionController::StopAI(const FString& InReason, const bool InbControlPerception)
{
if(InbControlPerception)
SetPerceptionActive(false);
Super::StopAI(InReason, InbControlPerception);
}
void AAIPerceptionController::ActivateBehaviorTree(APawn* InPawn)
{
Super::ActivateBehaviorTree(InPawn);
if(InPawn->GetClass()->ImplementsInterface(UAISettings::StaticClass()))
{
bool bUseSense = IAISettings::Execute_GetUseSight(InPawn) || IAISettings::Execute_GetUseHearing(InPawn);
if(bUseSense)
SetPerceptionActive(true);
}
}
void AAIPerceptionController::UpdatedTargetPerception(AActor* InTarget, FAIStimulus InStimulus)
{
if(!NMT_ENSURE(GetPawn())) return;
ACorePlayerCharacter* Player = Cast<ACorePlayerCharacter>(InTarget);
if(GetPawn()->GetClass()->ImplementsInterface(UAISettings::StaticClass()) && Player)
{
if(InStimulus.WasSuccessfullySensed())
{
bool PlayerUndetect;
Player->GetUnDetectState(PlayerUndetect);
if(PlayerUndetect || bUnDetect)
return;
TSubclassOf<UAISense> Sense = UAIPerceptionSystem::GetSenseClassForStimulus(GetWorld(), InStimulus);
if(IAISettings::Execute_GetUseSight(GetPawn()) && Sense == UAISense_Sight::StaticClass())
{
IAISettings::Execute_DetectTargetBySight(GetPawn(), InTarget, InStimulus);
}
UpdateTargetInfo(InTarget);
}
else
{
if(GetCheckedBlackboardComponent()->GetValueAsObject(UBlackboardKeyLibrary::GetTargetActorKey()) != nullptr)
{
IAISettings::Execute_ForgetTarget(GetPawn(), InTarget);
}
}
}
}
void AAIPerceptionController::SetPerceptionActive(const bool InbEnable)
{
NMT_CHECKF(PerceptionComponent)
if(InbEnable)
{
PerceptionComponent->OnTargetPerceptionUpdated.AddUniqueDynamic(this, &AAIPerceptionController::UpdatedTargetPerception);
}
else
{
GetCheckedBlackboardComponent()->SetValueAsObject(UBlackboardKeyLibrary::GetTargetActorKey(), nullptr);
PerceptionComponent->OnTargetPerceptionUpdated.Clear();
}
}
void AAIPerceptionController::UpdatePerceptionSystem() const
{
NMT_CHECKF(PerceptionComponent)
PerceptionComponent->RequestStimuliListenerUpdate();
PerceptionComponent->SetCanEverAffectNavigation(true);
}
void AAIPerceptionController::ForceUpdatePerception() const
{
NMT_CHECKF(PerceptionComponent)
if(PerceptionComponent->OnTargetPerceptionUpdated.IsBound())
{
TArray<AActor*> LocPerceivedActors;
PerceptionComponent->GetCurrentlyPerceivedActors(UAISense_Sight::StaticClass(), LocPerceivedActors);
if(LocPerceivedActors.Num() > 0)
{
for(AActor* LocPerceiveActor : LocPerceivedActors)
{
FActorPerceptionBlueprintInfo LocPerceptionInfo;
PerceptionComponent->GetActorsPerception(LocPerceiveActor, LocPerceptionInfo);
PerceptionComponent->OnTargetPerceptionUpdated.Broadcast(LocPerceiveActor, LocPerceptionInfo.LastSensedStimuli[0]);
}
}
}
}
class UAISenseConfig_Sight* AAIPerceptionController::AddSightConfig()
{
UAISenseConfig_Sight* SightConfig = CreateOptionalDefaultSubobject<UAISenseConfig_Sight>(TEXT("SightConfig"));
SightConfig->DetectionByAffiliation.bDetectEnemies = true;
SightConfig->DetectionByAffiliation.bDetectNeutrals = false;
SightConfig->DetectionByAffiliation.bDetectFriendlies = false;
NMT_CHECKF(PerceptionComponent)
PerceptionComponent->SetDominantSense(*SightConfig->GetSenseImplementation());
PerceptionComponent->ConfigureSense(*SightConfig);
return SightConfig;
}
class UAISenseConfig_Hearing* AAIPerceptionController::AddHearingConfig()
{
UAISenseConfig_Hearing* HearingConfig = CreateOptionalDefaultSubobject<UAISenseConfig_Hearing>(TEXT("HearingConfig"));
HearingConfig->DetectionByAffiliation.bDetectEnemies = true;
HearingConfig->DetectionByAffiliation.bDetectNeutrals = false;
HearingConfig->DetectionByAffiliation.bDetectFriendlies = false;
NMT_CHECKF(PerceptionComponent)
PerceptionComponent->SetDominantSense(*HearingConfig->GetSenseImplementation());
PerceptionComponent->ConfigureSense(*HearingConfig);
return HearingConfig;
}

View File

@ -0,0 +1,39 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AIControllerBase.h"
#include "AIPerceptionController.generated.h"
UCLASS()
class PROJECTT_API AAIPerceptionController : public AAIControllerBase
{
GENERATED_BODY()
public:
AAIPerceptionController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
virtual void OnPossess(APawn* InPawn) override;
virtual void Tick(float DeltaTime) override;
virtual void StartAI() override;
virtual void StopAI(const FString& InReason, const bool InbControlPerception = true) override;
virtual void ActivateBehaviorTree(APawn* InPawn) override;
void UpdatePerceptionSystem() const;
void ForceUpdatePerception() const;
void SetPerceptionActive(const bool InbEnable);
FORCEINLINE void SetUnDetect(const bool InbUnDetect) { bUnDetect = InbUnDetect; }
protected:
virtual void BeginPlay() override;
void SetupCrowdSettings(const FCrowdSettingsInfo& InCrowdSettings) const;
UFUNCTION()
void UpdatedTargetPerception(AActor* InTarget, FAIStimulus InStimulus);
class UAISenseConfig_Sight* AddSightConfig();
class UAISenseConfig_Hearing* AddHearingConfig();
uint8 bUnDetect;
};

View File

@ -0,0 +1,47 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AISightController.h"
#include "Perception/AISenseConfig_Sight.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/System/Core/Interfaces/AISettings.h"
AAISightController::AAISightController(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = true;
SightConfig = AddSightConfig();
}
void AAISightController::BeginPlay()
{
Super::BeginPlay();
}
void AAISightController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
NMT_CHECKF(SightConfig);
NMT_CHECKF(GetPawn());
if(GetPawn()->GetClass()->ImplementsInterface(UAISettings::StaticClass()))
{
FSightInfo SightInfo = IAISettings::Execute_GetSightInfo(GetPawn());
SightConfig->SightRadius = SightInfo.SightRange;
SightConfig->LoseSightRadius = SightInfo.LoseSightRange;
SightConfig->PeripheralVisionAngleDegrees = SightInfo.SightAngle / 2.f;
SightConfig->SetMaxAge(SightInfo.SightMaxAge);
}
UpdatePerceptionSystem();
}
void AAISightController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -0,0 +1,28 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AIPerceptionController.h"
#include "AISightController.generated.h"
UCLASS()
class PROJECTT_API AAISightController : public AAIPerceptionController
{
GENERATED_BODY()
public:
AAISightController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
protected:
virtual void BeginPlay() override;
public:
virtual void OnPossess(APawn* InPawn) override;
virtual void Tick(float DeltaTime) override;
public:
UPROPERTY(EditAnywhere, Category = "AIPerception")
class UAISenseConfig_Sight* SightConfig;
};

View File

@ -0,0 +1,53 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AISightHearingController.h"
#include "Perception/AISenseConfig_Hearing.h"
#include "Perception/AISenseConfig_Sight.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/System/Core/Interfaces/AISettings.h"
AAISightHearingController::AAISightHearingController(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = true;
HearingConfig = AddHearingConfig();
SightConfig = AddSightConfig();
}
void AAISightHearingController::BeginPlay()
{
Super::BeginPlay();
}
void AAISightHearingController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
NMT_CHECKF(SightConfig && HearingConfig);
NMT_CHECKF(GetPawn());
if(GetPawn()->GetClass()->ImplementsInterface(UAISettings::StaticClass()))
{
FSightInfo SightInfo = IAISettings::Execute_GetSightInfo(GetPawn());
SightConfig->SightRadius = SightInfo.SightRange;
SightConfig->LoseSightRadius = SightInfo.LoseSightRange;
SightConfig->PeripheralVisionAngleDegrees = SightInfo.SightAngle / 2.f;
SightConfig->SetMaxAge(SightInfo.SightMaxAge);
FHearingInfo HearingInfo = IAISettings::Execute_GetHearingInfo(InPawn);
HearingConfig->HearingRange = HearingInfo.HearingRange;
HearingConfig->SetMaxAge(HearingInfo.HearingMaxAge);
}
UpdatePerceptionSystem();
}
void AAISightHearingController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -0,0 +1,30 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AIPerceptionController.h"
#include "AISightHearingController.generated.h"
UCLASS()
class PROJECTT_API AAISightHearingController : public AAIPerceptionController
{
GENERATED_BODY()
public:
AAISightHearingController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
protected:
virtual void BeginPlay() override;
public:
virtual void OnPossess(APawn* InPawn) override;
virtual void Tick(float DeltaTime) override;
public:
UPROPERTY(EditAnywhere, Category = "AIPerception")
class UAISenseConfig_Sight* SightConfig;
UPROPERTY(EditAnywhere, Category = "AIPerception")
class UAISenseConfig_Hearing* HearingConfig;
};

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "NpcAnimInstance.h"
UNpcAnimInstance::UNpcAnimInstance() :
ForwardHeadRotation(FRotator(0.0, -90.0, 21.0)),
HeadRotation(ForwardHeadRotation),
HeadRotAlpha(0.f)
{
}
void UNpcAnimInstance::NativeInitializeAnimation()
{
Super::NativeInitializeAnimation();
}
void UNpcAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
Super::NativeUpdateAnimation(DeltaSeconds);
}

View File

@ -0,0 +1,32 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "NpcAnimInstance.generated.h"
UCLASS()
class PROJECTT_API UNpcAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
UNpcAnimInstance();
virtual void NativeInitializeAnimation() override;
virtual void NativeUpdateAnimation(float DeltaSeconds) override;
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
FRotator ForwardHeadRotation;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
FRotator HeadRotation;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
float HeadRotAlpha;
};

View File

@ -0,0 +1,11 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "NpcFixedAnimInstance.h"
UNpcFixedAnimInstance::UNpcFixedAnimInstance()
{
ForwardHeadRotation = FRotator(0.0, 0.0, 90.0);
HeadRotation = ForwardHeadRotation;
HeadRotAlpha = 0.f;
}

View File

@ -0,0 +1,20 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "NpcAnimInstance.h"
#include "NpcFixedAnimInstance.generated.h"
/**
*
*/
UCLASS()
class PROJECTT_API UNpcFixedAnimInstance : public UNpcAnimInstance
{
GENERATED_BODY()
public:
UNpcFixedAnimInstance();
};

View File

@ -0,0 +1,951 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CoreNpc.h"
#include "NiagaraComponent.h"
#include "AI/Controllers/AISightController.h"
#include "Components/CapsuleComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "Kismet/KismetMathLibrary.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/Data/Gen/GenerateEnumObjectiveSubTypes.h"
#include "ProjectT/System/Core/Characters/NPC/Animations/NpcAnimInstance.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
#include "ProjectT/System/Core/Common/GlobalUtilsLibrary.h"
#include "ProjectT/System/Core/Components/ObstacleFilterComponent.h"
#include "ProjectT/System/Core/Components/VisionConeComponent.h"
#include "ProjectT/System/Core/GameModes/WorldGameMode.h"
#include "ProjectT/System/Core/Interfaces/GlobalObjectProvider.h"
#include "ProjectT/System/Core/Managers/CoreCheatManager.h"
#include "ProjectT/System/Core/Managers/NotificationCenter.h"
#include "ProjectT/System/Core/Managers/QuestManager.h"
#include "ProjectT/System/SinglePlay/Components/SPNpcStatusComponent.h"
#define ACTIVATE_CHARACTER 1
ACoreNpc::ACoreNpc() :
DefaultLocation(),
DefaultRotation(),
bReachedHeadRotation(false),
bCanRotateHeadToTarget(false),
bEnableRespawn(0),
RespawnTime(0),
BehaviorTree(nullptr),
Blackboard(nullptr),
SpringArmComponent(nullptr),
VisionHead(nullptr),
VisionConeComponent(nullptr),
NpcStatusComponent(nullptr),
AlertComponent(nullptr),
CurrentState(ENpcState::Default),
PerceptionMaxAge(3.f),
NpcAnimInstance(nullptr),
bActivatedOnStart(true),
PrevState(ENpcState::Default),
CurrentDoubtState(EDoubtState::None),
EyeSocketName(TEXT("SKT_NPC_Vision")),
AlertSphereProfileName(TEXT("SoundRange")),
LoseSightOffset(10.f),
HeadRotSpeedMultiplier(4.f),
bCanTriggerAlert(true),
bUnDetect(false),
bFrustumCullingTimerSet(true),
bActivate(true),
bUseSocketTransformForVision(true)
{
PrimaryActorTick.bCanEverTick = true;
AIControllerClass = AAIControllerBase::StaticClass();
AutoPossessAI = EAutoPossessAI::PlacedInWorldOrSpawned;
GetCharacterMovement()->bUseControllerDesiredRotation = true;
GetCharacterMovement()->bOrientRotationToMovement = false;
GetCharacterMovement()->GetNavMovementProperties()->bUseAccelerationForPaths = true;
bUseControllerRotationYaw = false;
GetMesh()->SetAnimationMode(EAnimationMode::AnimationBlueprint);
GetMesh()->SetAnimInstanceClass(UNpcAnimInstance::StaticClass());
SubRootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SubRootComponent"));
WidgetRootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("WidgetRootComponent"));
SpringArmComponent = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArmComponent"));
VisionHead = CreateDefaultSubobject<USceneComponent>(TEXT("VisionHead"));
VisionConeComponent = CreateDefaultSubobject<UVisionConeComponent>(TEXT("VisionConeComponent"));
AlertComponent = CreateDefaultSubobject<UObstacleFilterComponent>(TEXT("AlertComponent"));
NpcStatusComponent = CreateDefaultSubobject<USPNpcStatusComponent>(TEXT("NpcStatusComponent"));
NoiseFXComponent = CreateDefaultSubobject<UNiagaraComponent>(TEXT("NoiseFXComponent"));
NMT_CHECKF(WidgetRootComponent && SubRootComponent && SpringArmComponent && VisionHead && VisionConeComponent && AlertComponent && NpcStatusComponent && NoiseFXComponent)
SubRootComponent->SetupAttachment(RootComponent);
WidgetRootComponent->SetupAttachment(RootComponent);
SpringArmComponent->SetupAttachment(SubRootComponent);
SpringArmComponent->bDoCollisionTest = false;
SpringArmComponent->TargetArmLength = 0.f;
SpringArmComponent->bInheritRoll = false;
SpringArmComponent->bInheritPitch = false;
SpringArmComponent->bEnableCameraLag = true;
SpringArmComponent->CameraLagSpeed = 0.f;
SpringArmComponent->bEnableCameraRotationLag = true;
SpringArmComponent->CameraRotationLagSpeed = 7.f;
SpringArmComponent->SetCanEverAffectNavigation(false);
VisionHead->SetupAttachment(SpringArmComponent);
VisionConeComponent->SetupAttachment(SpringArmComponent);
AlertComponent->SetupAttachment(SubRootComponent);
AlertComponent->DeactivateFiltering();
AlertComponent->SetCollisionProfileName(AlertSphereProfileName);
NoiseFXComponent->SetupAttachment(SubRootComponent);
NoiseFXComponent->bAutoActivate = false;
if(HeadRotationPatterns.IsEmpty())
SetupHeadRotationPattern();
}
void ACoreNpc::OnConstruction(const FTransform& Transform)
{
Super::OnConstruction(Transform);
DefaultLocation = GetActorLocation();
DefaultRotation = GetActorRotation();
}
void ACoreNpc::BeginPlay()
{
Super::BeginPlay();
ActivateCharacter(false);
InitializeProperty();
InitializeEvents();
}
void ACoreNpc::PostInitializeComponents()
{
Super::PostInitializeComponents();
}
void ACoreNpc::Enable_Implementation()
{
IPoolableActor::Enable_Implementation();
}
void ACoreNpc::Disable_Implementation()
{
IPoolableActor::Disable_Implementation();
}
void ACoreNpc::Pushed_Implementation()
{
IPoolableActor::Pushed_Implementation();
}
void ACoreNpc::Obtained_Implementation()
{
IPoolableActor::Obtained_Implementation();
}
void ACoreNpc::GetCurrentEffectTypes_Implementation(TArray<EEffectSubTypes>& OutEffectSubTypes)
{
TArray<EEffectSubTypes> LocReturnCurrentEffects;
EffectTimeMap.GetKeys(LocReturnCurrentEffects);
if(LocReturnCurrentEffects.Num() > 0)
{
OutEffectSubTypes = LocReturnCurrentEffects;
}
else
{
LocReturnCurrentEffects.Add(EEffectSubTypes::None);
OutEffectSubTypes = LocReturnCurrentEffects;
}
}
void ACoreNpc::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if(!bFrustumCullingTimerSet)
{
bFrustumCullingTimerSet = true;
UWorld* World = UGlobalUtilsLibrary::GetValidWorld(this);
World->GetTimerManager().SetTimer(UpdateActiveComponentHandle, this, &ACoreNpc::UpdateActiveComponentInFrustum, DeltaTime, true);
}
if(HeadRotationInfo.bOverrideHeadRotation)
UpdateHeadRotation(DeltaTime);
if(HeadRotationInfo.bChangeAlpha)
UpdateHeadRotationAlpha(DeltaTime);
SetSpringArmRotation();
if(VisionConeComponent->IsDrawing())
VisionConeComponent->UpdateVision(VisionHead->GetComponentRotation());
}
void ACoreNpc::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
UWorld* World = UGlobalUtilsLibrary::GetValidWorld(this);
World->GetTimerManager().ClearTimer(UpdateActiveComponentHandle);
World->GetTimerManager().ClearTimer(RespawnTimerHandle);
World->GetTimerManager().ClearTimer(CompleteAlertTimerHandle);
World->GetTimerManager().ClearTimer(EffectTimerHandle);
OnNpcDead.Clear();
OnNpcRespawn.Clear();
OnNpcIndicatorChanged.Clear();
}
void ACoreNpc::GetActorEyesViewPoint(FVector& Location, FRotator& Rotation) const
{
if(!VisionHead) return;
Location = VisionHead->GetComponentLocation();
Rotation = VisionHead->GetComponentRotation();
}
FEnemyNpc ACoreNpc::GetCurrentNpcStatus() const
{
if(!NMT_ENSURE(NpcStatusComponent))
return FEnemyNpc();
return NpcStatusComponent->GetCurrentNpcStatus();
}
void ACoreNpc::InitializeStatus(const FEnemyNpc InNpcStatus)
{
if(!NMT_ENSURE(NpcStatusComponent))
return;
bool bNpcDataValid = !InNpcStatus.IsDefault();
if(!NMT_ENSURE(bNpcDataValid)) return;
#if WITH_EDITOR
NpcStatusComponent->InitializeStatus(InNpcStatus);
#endif
}
void ACoreNpc::InitializeProperty()
{
NpcAnimInstance = Cast<UNpcAnimInstance>(GetMesh()->GetAnimInstance());
NMT_CHECKF(NpcAnimInstance && NpcStatusComponent)
FObstacleFilterInfo FilterInfo;
FilterInfo.SphereRadius = NpcStatusComponent->GetStatusNpcNoise();
FilterInfo.CheckOutOfRange = false;
AlertComponent->InitializeProperty(FilterInfo);
AlertComponent->DeactivateFiltering();
}
void ACoreNpc::InitializeEvents()
{
UNotificationCenter* NC = IGlobalObjectProvider::Execute_GetNotificationCenter(UGameplayStatics::GetGameInstance(this));
NC->AddObserverStatic(this, ENotificationTypes::GameState_Victory, FNotificationCenterStatic::CreateWeakLambda(this, [this]()
{
ResetStateAfterGameEnd();
}));
NC->AddObserverStatic(this, ENotificationTypes::GameState_Defeat, FNotificationCenterStatic::CreateWeakLambda(this, [this]()
{
ResetStateAfterGameEnd();;
}));
// FIXME
// NC->AddObserverStatic(this, ENotificationTypes::UI_DefeatActionCleared, FNotificationCenterStatic::CreateWeakLambda(this, [this]()
// {
// SetActorLocationAndRotation(DefaultLocation, DefaultRotation);
// SetActorHiddenInGame(true);
// NMT_LOG("UI_DefeatActionCleared")
// }));
// NC->AddObserverStatic(this, ENotificationTypes::UI_VictoryActionCleared, FNotificationCenterStatic::CreateWeakLambda(this, [this]()
// {
// SetActorLocationAndRotation(DefaultLocation, DefaultRotation);
// SetActorHiddenInGame(true);
// NMT_LOG("UI_VictoryActionCleared")
// }));
}
void ACoreNpc::Respawn()
{
Super::Respawn();
SetActorEnableCollision(true);
GetMesh()->bPauseAnims = false;
GetAIControllerBase()->StartAI();
SetActorHiddenInGame(false);
SetActorTickEnabled(true);
NpcStatusComponent->ReInitializeStatus();
ChangeNpcState(ENpcState::Default);
OnNpcRespawn.Broadcast();
}
void ACoreNpc::ChangeHeadRotationState(const EHeadRotationType InHeadRotationType)
{
bReachedHeadRotation = false;
switch(InHeadRotationType)
{
case EHeadRotationType::Pause:
{
NpcStatusComponent->SetStatusNpcRotationSpeed(NpcStatusComponent->GetPreviousNpcStatus().fRotationSpeed);
HeadRotationInfo.bOverrideHeadRotation = false;
break;
}
case EHeadRotationType::Search: case EHeadRotationType::LoopSearch:
{
NpcStatusComponent->SetStatusNpcRotationSpeed(NpcStatusComponent->GetPreviousNpcStatus().fRotationSpeed);
CurrentPhaseLists = *HeadRotationPatterns.Find(InHeadRotationType);
if(!CurrentPhaseLists.IsEmpty())
{
HeadRotationInfo.CurrentPhaseIdx = 0;
HeadRotationInfo.bOverrideHeadRotation = true;
}
break;
}
case EHeadRotationType::Guard:
{
NpcStatusComponent->SetStatusNpcRotationSpeed(NpcStatusComponent->GetPreviousNpcStatus().fRotationSpeed * HeadRotSpeedMultiplier);
CurrentPhaseLists = *HeadRotationPatterns.Find(InHeadRotationType);
if(!CurrentPhaseLists.IsEmpty())
{
HeadRotationInfo.CurrentPhaseIdx = 0;
HeadRotationInfo.bOverrideHeadRotation = true;
}
break;
}
case EHeadRotationType::TurnToTarget:
{
NpcStatusComponent->SetStatusNpcRotationSpeed(NpcStatusComponent->GetPreviousNpcStatus().fRotationSpeed * HeadRotSpeedMultiplier);
HeadRotationInfo.bOverrideHeadRotation = true;
break;
}
case EHeadRotationType::None:
{
NpcStatusComponent->SetStatusNpcRotationSpeed(NpcStatusComponent->GetPreviousNpcStatus().fRotationSpeed);
break;
}
}
HeadRotationInfo.HeadRotationType = InHeadRotationType;
}
void ACoreNpc::SetHeadRotationEnable(const bool InbEnable)
{
HeadRotationInfo.bChangeAlpha = true;
InbEnable ? HeadRotationInfo.TargetAlpha = 1.f : HeadRotationInfo.TargetAlpha = 0.f;
}
bool ACoreNpc::IsAggressiveState(const ENpcState InState) const
{
return InState == ENpcState::Chase || InState == ENpcState::Attack;
}
bool ACoreNpc::IsDamagedState(const ENpcState InState) const
{
return (InState == ENpcState::Hit || InState == ENpcState::Dead) || GetNpcStatusComponent()->IsDead();
}
void ACoreNpc::SetupHeadRotationPattern()
{
TArray<EHeadRotationPhase> List;
List.Append({EHeadRotationPhase::TurnRight, EHeadRotationPhase::TurnLeft, EHeadRotationPhase::TurnForward});
HeadRotationPatterns.Add(EHeadRotationType::Search, List);
List.Empty();
List.Append({EHeadRotationPhase::TurnRight, EHeadRotationPhase::TurnLeft, EHeadRotationPhase::TurnForward});
HeadRotationPatterns.Add(EHeadRotationType::Guard, List);
List.Empty();
List.Append({EHeadRotationPhase::TurnRight, EHeadRotationPhase::TurnLeft});
HeadRotationPatterns.Add(EHeadRotationType::LoopSearch, List);
}
void ACoreNpc::UpdateHeadRotation(float InDeltaTime)
{
if(!NMT_ENSURE(NpcStatusComponent))
return;
switch(HeadRotationInfo.HeadRotationType)
{
case EHeadRotationType::LoopSearch:
{
if(!NMT_MSG_ENSURE(CurrentPhaseLists.IsValidIndex(HeadRotationInfo.CurrentPhaseIdx), "Not ValidIndex in CurrentPhaseLists %d", HeadRotationInfo.CurrentPhaseIdx))
{
ResetHeadRotation();
bReachedHeadRotation = true;
HeadRotationInfo.bOverrideHeadRotation = false;
return;
}
if(CurrentPhaseLists[HeadRotationInfo.CurrentPhaseIdx] == EHeadRotationPhase::TurnRight)
{
HeadRotationInfo.TargetRotation = FRotator(NpcAnimInstance->ForwardHeadRotation.Pitch, NpcAnimInstance->ForwardHeadRotation.Yaw + NpcStatusComponent->GetStatusNpcHalfRotationAngle(), NpcAnimInstance->ForwardHeadRotation.Roll);
}
else if(CurrentPhaseLists[HeadRotationInfo.CurrentPhaseIdx] == EHeadRotationPhase::TurnLeft)
{
HeadRotationInfo.TargetRotation = FRotator(NpcAnimInstance->ForwardHeadRotation.Pitch, NpcAnimInstance->ForwardHeadRotation.Yaw - NpcStatusComponent->GetStatusNpcHalfRotationAngle(), NpcAnimInstance->ForwardHeadRotation.Roll);
}
if(NpcAnimInstance->HeadRotation.Equals(HeadRotationInfo.TargetRotation, 0.1f))
{
HeadRotationInfo.CurrentPhaseIdx == 0 ? HeadRotationInfo.CurrentPhaseIdx++ : HeadRotationInfo.CurrentPhaseIdx--;
}
NpcAnimInstance->HeadRotation = FMath::RInterpTo(NpcAnimInstance->HeadRotation, HeadRotationInfo.TargetRotation, InDeltaTime, NpcStatusComponent->GetStatusNpcRotationSpeed());
break;
}
case EHeadRotationType::Search: case EHeadRotationType::Guard:
{
if(!NMT_MSG_ENSURE(CurrentPhaseLists.IsValidIndex(HeadRotationInfo.CurrentPhaseIdx), "Not ValidIndex in CurrentPhaseLists %d", HeadRotationInfo.CurrentPhaseIdx))
{
ResetHeadRotation();
bReachedHeadRotation = true;
HeadRotationInfo.bOverrideHeadRotation = false;
return;
}
if(CurrentPhaseLists[HeadRotationInfo.CurrentPhaseIdx] == EHeadRotationPhase::TurnRight)
{
HeadRotationInfo.TargetRotation = FRotator(NpcAnimInstance->ForwardHeadRotation.Pitch, NpcAnimInstance->ForwardHeadRotation.Yaw + NpcStatusComponent->GetStatusNpcHalfRotationAngle(), NpcAnimInstance->ForwardHeadRotation.Roll);
}
else if(CurrentPhaseLists[HeadRotationInfo.CurrentPhaseIdx] == EHeadRotationPhase::TurnLeft)
{
HeadRotationInfo.TargetRotation = FRotator(NpcAnimInstance->ForwardHeadRotation.Pitch, NpcAnimInstance->ForwardHeadRotation.Yaw - NpcStatusComponent->GetStatusNpcHalfRotationAngle(), NpcAnimInstance->ForwardHeadRotation.Roll);
}
else if(CurrentPhaseLists[HeadRotationInfo.CurrentPhaseIdx] == EHeadRotationPhase::TurnForward)
{
HeadRotationInfo.TargetRotation = NpcAnimInstance->ForwardHeadRotation;
}
if(NpcAnimInstance->HeadRotation.Equals(HeadRotationInfo.TargetRotation, 0.1f))
{
HeadRotationInfo.CurrentPhaseIdx++;
if(HeadRotationInfo.CurrentPhaseIdx >= CurrentPhaseLists.Num())
{
bReachedHeadRotation = true;
ResetHeadRotation();
}
}
NpcAnimInstance->HeadRotation = FMath::RInterpTo(NpcAnimInstance->HeadRotation, HeadRotationInfo.TargetRotation, InDeltaTime, NpcStatusComponent->GetStatusNpcRotationSpeed());
break;
}
case EHeadRotationType::TurnToTarget:
{
if(NpcAnimInstance->HeadRotation.Equals(HeadRotationInfo.TargetRotation, 0.1f))
{
bReachedHeadRotation = true;
HeadRotationInfo.bOverrideHeadRotation = false;
ResetHeadRotation();
}
NpcAnimInstance->HeadRotation = FMath::RInterpTo(NpcAnimInstance->HeadRotation, HeadRotationInfo.TargetRotation, InDeltaTime, NpcStatusComponent->GetStatusNpcRotationSpeed());
break;
}
case EHeadRotationType::Pause: case EHeadRotationType::None:
break;
default : NMT_MSG_ENSURE(0, "Not Valid HeadRotation Type");
}
}
void ACoreNpc::UpdateHeadRotationAlpha(float InDeltaTime)
{
if(FMath::IsNearlyEqual(NpcAnimInstance->HeadRotAlpha, HeadRotationInfo.TargetAlpha))
{
NpcAnimInstance->HeadRotAlpha = HeadRotationInfo.TargetAlpha;
HeadRotationInfo.bChangeAlpha = false;
}
NpcAnimInstance->HeadRotAlpha = FMath::FInterpTo(NpcAnimInstance->HeadRotAlpha, HeadRotationInfo.TargetAlpha, InDeltaTime, 5.f);
}
void ACoreNpc::ResetHeadRotation()
{
HeadRotationInfo.CurrentPhaseIdx = 0;
HeadRotationInfo.HeadRotationType = EHeadRotationType::None;
}
void ACoreNpc::SetUnDetectTarget(const bool InbUnDetect)
{
bUnDetect = InbUnDetect;
}
void ACoreNpc::PostAlert() const
{
AlertComponent->DeactivateFiltering();
}
bool ACoreNpc::CheckEffectTime(const FEffect& InEffect)
{
bool LocbRefreshEffect = false;
EEffectSubTypes LocEffectSubType = UGlobalUtilsLibrary::GetStringToEnum<EEffectSubTypes>(InEffect.sEffect);
if(EffectTimeMap.Find(LocEffectSubType))
{
if(EffectTimeMap.Find(LocEffectSubType)->EffectValue > InEffect.fEffectValue)
return LocbRefreshEffect;
if(EffectTimeMap.Find(LocEffectSubType)->EffectValue == InEffect.fEffectValue)
{
if(EffectTimeMap.Find(LocEffectSubType)->RemainTime < InEffect.fEffectDuration)
LocbRefreshEffect = true;
}
else
LocbRefreshEffect = true;
}
else
LocbRefreshEffect = true;
return LocbRefreshEffect;
}
void ACoreNpc::AddEffectTimeMap(const FEffect& InEffect)
{
FNpcEffectValue LocEffectValue;
EEffectSubTypes LocEffectSubType = UGlobalUtilsLibrary::GetStringToEnum<EEffectSubTypes>(InEffect.sEffect);
if(EffectTimeMap.Find(LocEffectSubType))
{
if(EffectTimeMap.Find(LocEffectSubType)->EffectValue > InEffect.fEffectValue) return;
if(EffectTimeMap.Find(LocEffectSubType)->EffectValue == InEffect.fEffectValue)
{
if(EffectTimeMap.Find(LocEffectSubType)->RemainTime < InEffect.fEffectDuration)
{
LocEffectValue.RemainTime = InEffect.fEffectDuration;
LocEffectValue.MaxTime = InEffect.fEffectDuration;
LocEffectValue.EffectValue = InEffect.fEffectValue;
EffectTimeMap.Add(LocEffectSubType, LocEffectValue);
}
}
else
{
LocEffectValue.RemainTime = InEffect.fEffectDuration;
LocEffectValue.MaxTime = InEffect.fEffectDuration;
LocEffectValue.EffectValue = InEffect.fEffectValue;
EffectTimeMap.Add(LocEffectSubType, LocEffectValue);
}
}
else
{
LocEffectValue.RemainTime = InEffect.fEffectDuration;
LocEffectValue.MaxTime = InEffect.fEffectDuration;
LocEffectValue.EffectValue = InEffect.fEffectValue;
EffectTimeMap.Add(LocEffectSubType, LocEffectValue);
}
if(!GetWorld()->GetTimerManager().IsTimerActive(EffectTimerHandle))
GetWorld()->GetTimerManager().SetTimer(EffectTimerHandle, this, &ACoreNpc::EffectTimeDown, GetWorld()->DeltaTimeSeconds, true);
}
void ACoreNpc::EffectTimeDown()
{
TArray<EEffectSubTypes> LocEffectSubType;
EffectTimeMap.GetKeys(LocEffectSubType);
FEffect LocRemoveEffect;
for(EEffectSubTypes LocKey : LocEffectSubType)
{
float LocCurRemainTime = EffectTimeMap.Find(LocKey)->RemainTime;
LocCurRemainTime = LocCurRemainTime - GetWorld()->DeltaTimeSeconds;
if(LocCurRemainTime <= 0.f)
{
TArray<FEffect> LocRemoveEffects;
LocRemoveEffect.sEffect = EnumToString(LocKey);
LocRemoveEffect.fEffectValue = EffectTimeMap.Find(LocKey)->EffectValue;
LocRemoveEffects.Add(LocRemoveEffect);
ApplyRecoveryEvent_Implementation(LocRemoveEffects);
}
else
{
EffectTimeMap.Find(LocKey)->RemainTime = LocCurRemainTime;
}
}
}
void ACoreNpc::SetReturnLocationFromDefault() const
{
if(GetNpcState() == ENpcState::Default)
GetAIControllerBase()->UpdateReturnLocation(GetActorLocation());
}
void ACoreNpc::ChangeIndicatorState(const ENpcState InState)
{
if(NpcStatusComponent->IsDead())
return;
ENpcIndicatorState NewIndicatorState = LastIndicatorState;
switch(InState)
{
case ENpcState::Doubt: case ENpcState::Guard:
{
NewIndicatorState = ENpcIndicatorState::Question;
break;
}
case ENpcState::Chase: case ENpcState::Attack:
{
NewIndicatorState = ENpcIndicatorState::Exclamation;
break;
}
case ENpcState::Default: case ENpcState::Returning: case ENpcState::Hit: case ENpcState::Dead:
break;
default: NMT_LOG("Not Valid Type")
}
if(NewIndicatorState != LastIndicatorState)
{
LastIndicatorState = NewIndicatorState;
OnNpcIndicatorChanged.Broadcast(NewIndicatorState);
}
}
void ACoreNpc::ChangeToChaseInDoubtGauge()
{
GetAIControllerBase()->UpdateReturnLocation(GetActorLocation());
ChangeNpcState(ENpcState::Chase);
ApplyStateToQuest(ENpcState::Chase);
}
void ACoreNpc::DebugToggleFrustum()
{
UCoreCheatManager* CCM = UGlobalUtilsLibrary::GetSharedCoreCheatManager(this);
UWorld* World = UGlobalUtilsLibrary::GetValidWorld(this);
if(UpdateActiveComponentHandle.IsValid())
{
if(CCM->GetDebugStatus().bDebugVision)
{
World->GetTimerManager().PauseTimer(UpdateActiveComponentHandle);
VisionConeComponent->ToggleDraw(true);
}
else
{
VisionConeComponent->ToggleDraw(false);
World->GetTimerManager().UnPauseTimer(UpdateActiveComponentHandle);
}
}
}
class AAIControllerBase* ACoreNpc::GetAIControllerBase() const
{
AAIControllerBase* AIC = Cast<AAIControllerBase>(GetController());
NMT_CHECKF(AIC)
return AIC;
}
bool ACoreNpc::CanDetectTargetFromNoise() const
{
return !bUnDetect && !GetNpcStatusComponent()->IsDead() && !GetAIControllerBase()->GetTargetActor() && CurrentState != ENpcState::Attack;
}
void ACoreNpc::ApplyStateToQuest(const ENpcState InState)
{
UWorld* World = UGlobalUtilsLibrary::GetValidWorld(this);
AWorldGameMode* GM = UGlobalUtilsLibrary::GetGameModeChecked<AWorldGameMode>(World);
UQuestManager* QM = IWorldObjectProvider::Execute_GetQuestManager(GM);
NMT_CHECKF(QM);
switch(InState)
{
case ENpcState::Chase:
{
NMT_LOG("Avoid")
QM->CheckObjectiveSatisfied(EObjectiveSubTypes::Avoid);
break;
}
case ENpcState::Dead:
{
QM->CheckObjectiveSatisfied(EObjectiveSubTypes::Kill);
break;
}
case ENpcState::Guard:
case ENpcState::Hit:
case ENpcState::Attack:
case ENpcState::Default:
case ENpcState::Returning:
case ENpcState::Doubt:
default: NOT_IMPLEMENTED(); break;
}
}
void ACoreNpc::Alert(const FVector& InTargetLocation)
{
if(!bCanTriggerAlert || GetNpcStatusComponent()->IsDead())
return;
NMT_CHECKF(NpcStatusComponent)
NMT_LOG("Alert")
bCanTriggerAlert = false;
AlertComponent->ActivateFiltering();
TArray<AActor*> DetectedNpcs = AlertComponent->GetNonBlockedActors(InTargetLocation);
for(AActor* Npc : DetectedNpcs)
{
ACoreNpc* OtherNpc = Cast<ACoreNpc>(Npc);
if(!OtherNpc)
continue;
OtherNpc->SetDetectLocationFromNoise(InTargetLocation);
}
NoiseFXComponent->SetFloatParameter(FName("Wave Radius"), NpcStatusComponent->GetStatusNpcNoise());
NoiseFXComponent->Activate(true);
UWorld* World = UGlobalUtilsLibrary::GetValidWorld(this);
World->GetTimerManager().SetTimer(CompleteAlertTimerHandle, this, &ACoreNpc::PostAlert, 0.5f, false);
}
void ACoreNpc::SetDetectTargetFromNoise(AActor* InTarget)
{
if(!CanDetectTargetFromNoise())
return;
GetAIControllerBase()->UpdateTargetInfo(InTarget);
HandleForceDetectFromNoise(true);
NMT_LOG("SetDetectTargetFromNoise")
}
void ACoreNpc::SetDetectLocationFromNoise(const FVector& InTargetLocation)
{
if(!CanDetectTargetFromNoise())
return;
GetAIControllerBase()->UpdateTargetLocation(InTargetLocation);
GetAIControllerBase()->UpdateTargetDirection((InTargetLocation - GetActorLocation()).GetSafeNormal());
HandleForceDetectFromNoise(false);
NMT_LOG("SetDetectLocationFromNoise")
}
void ACoreNpc::UpdateDoubtVisualize(const float InCurrentDoubtTime)
{
double GaugeLength = UKismetMathLibrary::MapRangeClamped(InCurrentDoubtTime, 0.f, NpcStatusComponent->GetStatusPreviousNpcDoubtTime(), 20.f, NpcStatusComponent->GetStatusNpcSightLength());
VisionConeComponent->UpdateVisionGauge(GaugeLength);
AActor* Target = GetAIControllerBase()->GetTargetActor();
if(!Target)
return;
if(GaugeLength >= GetHorizontalDistanceTo(Target))
{
ChangeToChaseInDoubtGauge();
}
}
void ACoreNpc::UpdateDoubtTime(const float InCurrentDoubtTime)
{
NMT_CHECKF(NpcStatusComponent)
NpcStatusComponent->UpdateCurrentDoubtTime(FMath::Clamp(InCurrentDoubtTime, 0.f, NpcStatusComponent->GetPreviousNpcStatus().fDoubtTime));
UpdateDoubtVisualize(InCurrentDoubtTime);
}
void ACoreNpc::ChangeDoubtState(const EDoubtState InDoubtState)
{
CurrentDoubtState = InDoubtState;
GetAIControllerBase()->UpdateDoubtState(InDoubtState);
switch(InDoubtState)
{
case EDoubtState::None:
{
UpdateDoubtTime(0.f);
UpdateDoubtVisualize(0.f);
break;
}
case EDoubtState::Increasing: case EDoubtState::Decreasing: break;
default: NOT_IMPLEMENTED();
}
}
void ACoreNpc::SetHeadTargetRotation(const FVector& InTargetLocation)
{
NMT_CHECKF(NpcStatusComponent)
FVector EyeLocation = GetMesh()->GetSocketLocation(EyeSocketName);
FRotator EyeRotation = GetMesh()->GetSocketRotation(EyeSocketName);
FRotator WorldLookRotator = UKismetMathLibrary::FindLookAtRotation(EyeLocation, InTargetLocation);
FRotator CompLookRotator = WorldLookRotator - EyeRotation;
float TargetYaw = FMath::Clamp(NpcAnimInstance->ForwardHeadRotation.Yaw + CompLookRotator.Yaw, NpcAnimInstance->ForwardHeadRotation.Yaw - NpcStatusComponent->GetStatusNpcHalfRotationAngle(), NpcAnimInstance->ForwardHeadRotation.Yaw + NpcStatusComponent->GetStatusNpcHalfRotationAngle());
HeadRotationInfo.TargetRotation = FRotator(NpcAnimInstance->ForwardHeadRotation.Pitch, TargetYaw, NpcAnimInstance->ForwardHeadRotation.Roll);
}
TArray<EEffectSubTypes> ACoreNpc::GetCurrentEffects() const
{
TArray<EEffectSubTypes> LocReturnCurrentEffects;
EffectTimeMap.GetKeys(LocReturnCurrentEffects);
if(LocReturnCurrentEffects.Num() > 0)
return LocReturnCurrentEffects;
LocReturnCurrentEffects.Add(EEffectSubTypes::None);
return LocReturnCurrentEffects;
}
void ACoreNpc::HandleForceDetectFromNoise(const bool InbDetectTarget)
{
bCanTriggerAlert = false;
SetReturnLocationFromDefault();
if(!IsDamagedState(CurrentState))
{
ChangeNpcState(ENpcState::Chase);
if(InbDetectTarget && (PrevState != ENpcState::Attack && PrevState != ENpcState::Hit))
{
ApplyStateToQuest(ENpcState::Chase);
}
}
}
void ACoreNpc::ChangeNpcState(const ENpcState InState)
{
PrevState = CurrentState;
if(CurrentState != InState)
{
switch(InState)
{
case ENpcState::Guard:
{
bCanTriggerAlert = true;
break;
}
case ENpcState::Chase: case ENpcState::Attack: case ENpcState::Default: case ENpcState::Doubt: case ENpcState::Returning: case ENpcState::Hit: case ENpcState::Dead:
break;
default: NMT_LOG("Not Valid ENpcState");
}
CurrentState = InState;
GetAIControllerBase()->ChangeNpcStateKey(InState);
}
}
void ACoreNpc::StartDisableNpc()
{
OnNpcDead.Broadcast();
SetActorEnableCollision(false);
GetCharacterMovement()->SetMovementMode(MOVE_None);
GetAIControllerBase()->StopAI("Death");
NMT_LOG("DisableNpc")
}
void ACoreNpc::CompleteDisableNpc()
{
UWorld* World = UGlobalUtilsLibrary::GetValidWorld(this);
SetActorHiddenInGame(true);
SetActorTickEnabled(false);
SetActorLocation(DefaultLocation);
SetActorRotation(DefaultRotation);
ChangeDoubtState(EDoubtState::None);
LastIndicatorState = ENpcIndicatorState::None;
if(bEnableRespawn)
{
World->GetTimerManager().SetTimer(RespawnTimerHandle, this, &ACoreNpc::Respawn, RespawnTime, false);
}
}
void ACoreNpc::ResetStateAfterGameEnd()
{
if(!bActivate)
return;
AAIControllerBase* AIC = GetAIControllerBase();
if(AIC->GetTargetActor())
AIC->UpdateTargetInfo(nullptr);
ChangeNpcState(ENpcState::Default);
ChangeDoubtState(EDoubtState::None);
NpcStatusComponent->ReInitializeStatus();
LastIndicatorState = ENpcIndicatorState::None;
AIC->StopAI("Ending", false);
SetActorTickEnabled(false);
}
void ACoreNpc::ActivateCharacter(const bool InbEnable)
{
SetActorTickEnabled(InbEnable);
SetActorHiddenInGame(!InbEnable);
TArray<USceneComponent*> Components;
GetComponents(Components);
for (USceneComponent* Component : Components)
{
Component->SetComponentTickEnabled(InbEnable);
}
if(InbEnable)
{
bFrustumCullingTimerSet = false;
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::Type::QueryAndPhysics);
GetAIControllerBase()->ActivateBehaviorTree(this);
}
else
{
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
}
bActivate = InbEnable;
}
void ACoreNpc::SetSpringArmRotation()
{
if(!bUseSocketTransformForVision)
return;
FRotator ArmRotator = SpringArmComponent->GetComponentRotation();
SpringArmComponent->SetWorldRotation(UKismetMathLibrary::MakeRotator(ArmRotator.Roll, ArmRotator.Pitch, GetMesh()->GetSocketRotation(EyeSocketName).Yaw));
}
void ACoreNpc::SetVisionMode(EVisionMode InSightMode)
{
NOT_IMPLEMENTED()
}
void ACoreNpc::UpdateActiveComponentInFrustum() const
{
APlayerController* PC = UGameplayStatics::GetPlayerController(this, 0);
NMT_CHECKF(PC)
if(ULocalPlayer* LocalPlayer = PC->GetLocalPlayer())
{
FSceneViewProjectionData ProjectionData;
if(LocalPlayer->GetProjectionData(LocalPlayer->ViewportClient->Viewport, ProjectionData))
{
const FMatrix ViewProjectionMatrix = ProjectionData.ComputeViewProjectionMatrix();
FConvexVolume Frustum;
GetViewFrustumBounds(Frustum, ViewProjectionMatrix, true);
bool bInFrustum = Frustum.IntersectSphere(RootComponent->GetComponentLocation(), VisionConeComponent->SightRange);
bool bDoNotDraw = IsDamagedState(CurrentState) || bUnDetect;
bDoNotDraw |= IsAggressiveState(CurrentState);
if(VisionConeComponent->IsAllowedDrawing())
VisionConeComponent->ToggleDraw(bInFrustum && !bDoNotDraw);
}
}
}
class USPNpcStatusComponent* ACoreNpc::GetNpcStatusComponent() const
{
NMT_CHECKF(NpcStatusComponent)
return NpcStatusComponent;
}
#if WITH_EDITOR
void ACoreNpc::ApplyCharacterData(const FTableRowBase* RowData)
{
if(!GEditor) return;
if(!RowData)
{
UE_LOG(LogTemp, Error, TEXT("RowName Is Not Valid"))
InitializeStatus(FEnemyNpc());
return;
}
const FEnemyNpc* GetData = static_cast<const FEnemyNpc*>(RowData);
NMT_CHECKF(GetData)
if(*GetData == NpcStatusComponent->GetCurrentNpcStatus()) return;
if(GEditor->GetEditorWorldContext().World())
InitializeStatus(*GetData);
}
#endif

View File

@ -0,0 +1,282 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/Data/Gen/GenerateEnumContentType.h"
#include "ProjectT/Data/Gen/GenerateStructEnemyNPC.h"
#include "ProjectT/Data/Npc/NpcDataModel.h"
#include "ProjectT/System/Core/Characters/CombatCharacter.h"
#include "ProjectT/System/Core/Interfaces/Damageable.h"
#include "ProjectT/System/Core/Interfaces/PoolableActor.h"
#include "CoreNpc.generated.h"
struct FEnemyNpc;
UENUM(BlueprintType)
enum class EHeadRotationPhase : uint8
{
TurnForward = 0 UMETA(DisplayName = "TurnForward"),
TurnRight UMETA(DisplayName = "TurnRight"),
TurnLeft UMETA(DisplayName = "TurnLeft"),
};
UENUM(BlueprintType)
enum class ENpcIndicatorState : uint8
{
None = 0 UMETA(DisplayName = "None"),
Hide UMETA(DisplayName = "Hide"),
Question UMETA(DisplayName = "Question"),
Exclamation UMETA(DisplayName = "Exclamation"),
};
USTRUCT(BlueprintType)
struct FHeadRotationInfo
{
GENERATED_BODY()
FHeadRotationInfo() :
bOverrideHeadRotation(false),
bChangeAlpha(false),
TargetRotation(FRotator::ZeroRotator),
HeadRotationType(EHeadRotationType::None),
CurrentPhaseIdx(0),
RotationSpeed(0.f),
RotationHalfAngle(0.f),
TargetAlpha(0.f)
{}
UPROPERTY(EditAnywhere, BlueprintReadWrite)
uint8 bOverrideHeadRotation : 1;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
uint8 bChangeAlpha;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
FRotator TargetRotation;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
EHeadRotationType HeadRotationType;
UPROPERTY(BlueprintReadOnly)
int32 CurrentPhaseIdx;
UPROPERTY(BlueprintReadOnly)
float RotationSpeed;
UPROPERTY(BlueprintReadOnly)
float RotationHalfAngle;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
float TargetAlpha;
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnNpcDead);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnNpcRespawn);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnNpcIndicatorChanged, ENpcIndicatorState, IndicatorState);
UCLASS()
class PROJECTT_API ACoreNpc : public ACombatCharacter, public IPoolableActor, public IDamageable
{
GENERATED_BODY()
CONTENT_TYPE_NUMBER(EContentType::EnemyNpc)
public:
ACoreNpc();
virtual void OnConstruction(const FTransform& Transform) override;
virtual void Tick(float DeltaTime) override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void GetActorEyesViewPoint( FVector& Location, FRotator& Rotation) const override;
virtual void PostInitializeComponents() override;
virtual void Enable_Implementation() override;
virtual void Disable_Implementation() override;
virtual void Pushed_Implementation() override;
virtual void Obtained_Implementation() override;
virtual void GetCurrentEffectTypes_Implementation(TArray<EEffectSubTypes>& OutEffectSubTypes) override;
virtual void CompleteDisableNpc();
virtual void ActivateCharacter(const bool InbEnable);
virtual void SetDetectTargetFromNoise(AActor* InTarget);
virtual void SetDetectLocationFromNoise(const FVector& InTargetLocation);
virtual void SetVisionMode(EVisionMode InSightMode);
virtual void UpdateDoubtTime(const float InCurrentDoubtTime);
virtual void ChangeDoubtState(const EDoubtState InDoubtState);
void UpdateDoubtVisualize(const float InCurrentDoubtTime);
UFUNCTION(BlueprintCallable)
virtual void StartDisableNpc();
UFUNCTION(BlueprintCallable)
class USPNpcStatusComponent* GetNpcStatusComponent() const;
UFUNCTION(BlueprintPure)
FORCEINLINE ENpcState GetNpcState() const { return CurrentState; }
UFUNCTION(BlueprintPure)
FORCEINLINE ENpcState GetNpcPrevState() const { return PrevState; }
UFUNCTION(BlueprintPure)
FORCEINLINE FVector GetRespawnLocation() const { return DefaultLocation; }
UFUNCTION(BlueprintCallable)
void ChangeHeadRotationState(const EHeadRotationType InHeadRotationType);
UFUNCTION(BlueprintCallable)
virtual void ChangeNpcState(const ENpcState InState);
FORCEINLINE bool GetCanTriggerAlert() const { return bCanTriggerAlert; }
FORCEINLINE bool GetActivatedOnStart() { return bActivatedOnStart; }
FORCEINLINE void SetActivatedOnStart(bool InbActivate) { bActivatedOnStart = InbActivate; }
FORCEINLINE EDoubtState GetCurrentDoubtState() const { return CurrentDoubtState; }
FORCEINLINE EVisionMode GetCurrentVisionMode() const { return CurrentVisionMode; }
FORCEINLINE EHeadRotationType GetHeadRotationType() const { return HeadRotationInfo.HeadRotationType; }
void UpdateActiveComponentInFrustum() const;
void SetCanTriggerAlert(const bool InbCanTrigger) { bCanTriggerAlert = InbCanTrigger; }
void SetHeadRotationEnable(const bool InbEnable);
bool IsAggressiveState(const ENpcState InState) const;
bool IsDamagedState(const ENpcState InState) const;
void Alert(const FVector& InTargetLocation);
void HandleForceDetectFromNoise(const bool InbDetectTarget);
FEnemyNpc GetCurrentNpcStatus() const;
class AAIControllerBase* GetAIControllerBase() const;
bool CanDetectTargetFromNoise() const;
void ApplyStateToQuest(const ENpcState InState);
void ChangeToChaseInDoubtGauge();
void DebugToggleFrustum();
void SetHeadTargetRotation(const FVector& InTargetLocation);
TArray<EEffectSubTypes> GetCurrentEffects() const;
protected:
virtual void BeginPlay() override;
#if WITH_EDITOR
virtual void ApplyCharacterData(const FTableRowBase* RowData) override;
#endif
virtual void InitializeStatus(const FEnemyNpc InNpcStatus);
virtual void InitializeProperty();
virtual void InitializeEvents();
virtual void Respawn() override;
virtual void ResetStateAfterGameEnd();
virtual void SetSpringArmRotation();
virtual void SetUnDetectTarget(const bool InbUnDetect);
virtual void ChangeIndicatorState(const ENpcState InState);
void SetupHeadRotationPattern();
void UpdateHeadRotation(float InDeltaTime);
void UpdateHeadRotationAlpha(float InDeltaTime);
void ResetHeadRotation();
void PostAlert() const;
bool CheckEffectTime(const FEffect& InEffect);
void AddEffectTimeMap(const FEffect& InEffect);
void EffectTimeDown();
void SetReturnLocationFromDefault() const;
public:
UPROPERTY(BlueprintAssignable)
FOnNpcDead OnNpcDead;
UPROPERTY(BlueprintAssignable)
FOnNpcRespawn OnNpcRespawn;
UPROPERTY(BlueprintAssignable)
FOnNpcIndicatorChanged OnNpcIndicatorChanged;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FVector DefaultLocation;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FRotator DefaultRotation;
uint8 bReachedHeadRotation : 1;
uint8 bCanRotateHeadToTarget : 1;
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AISetting")
uint8 bEnableRespawn : 1;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AISetting", meta = (EditCondition = "bEnableRespawn", EditConditionHides))
float RespawnTime;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AISetting")
TObjectPtr<class UBehaviorTree> BehaviorTree;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AISetting")
TObjectPtr<class UBlackboardData> Blackboard;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Component")
TObjectPtr<class USceneComponent> SubRootComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Component")
TObjectPtr<class USceneComponent> WidgetRootComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Component")
TObjectPtr<class USpringArmComponent> SpringArmComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Component")
TObjectPtr<class USceneComponent> VisionHead;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Component")
TObjectPtr<class UVisionConeComponent> VisionConeComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component")
TObjectPtr<class USPNpcStatusComponent> NpcStatusComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component")
TObjectPtr<class UObstacleFilterComponent> AlertComponent;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Animation")
FHeadRotationInfo HeadRotationInfo;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<class UNiagaraComponent> NoiseFXComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta = (AllowPrivateAccess = "true"))
ENpcState CurrentState;
UPROPERTY(EditAnywhere)
float PerceptionMaxAge;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
ENpcIndicatorState LastIndicatorState;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TMap<EEffectSubTypes, FNpcEffectValue> EffectTimeMap;
UPROPERTY()
TObjectPtr<class UNpcAnimInstance> NpcAnimInstance;
UPROPERTY()
TArray<EHeadRotationPhase> CurrentPhaseLists;
UPROPERTY()
FTimerHandle UpdateActiveComponentHandle;
UPROPERTY()
FTimerHandle RespawnTimerHandle;
UPROPERTY()
FTimerHandle EffectTimerHandle;
UPROPERTY()
FTimerHandle CompleteAlertTimerHandle;
UPROPERTY()
uint8 bActivatedOnStart : 1;
ENpcState PrevState;
EDoubtState CurrentDoubtState;
EVisionMode CurrentVisionMode;
FName EyeSocketName;
FName AlertSphereProfileName;
TMap<EHeadRotationType, TArray<EHeadRotationPhase>> HeadRotationPatterns;
float LoseSightOffset;
float HeadRotSpeedMultiplier;
uint8 bCanTriggerAlert : 1;
uint8 bUnDetect : 1;
uint8 bFrustumCullingTimerSet : 1;
uint8 bActivate : 1;
uint8 bUseSocketTransformForVision : 1;
};

View File

@ -0,0 +1,149 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "PlayerCharacterAnimInstance.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
UPlayerCharacterAnimInstance::UPlayerCharacterAnimInstance() :
OwnerPlayerCharacter(nullptr),
bPlayerInputable(true),
bIdle(true),
bRest(false),
bWalk(false),
bRun(false),
bAction(false),
bModify(false),
PlayerActionMontage(nullptr),
PlayerCommonMontage(nullptr),
PlayerIdleAnimation(nullptr),
PlayerMoveAnimation(nullptr),
PlayerRunAnimation(nullptr),
ModifyIdleAnimation(nullptr),
ModifyMoveAnimation(nullptr),
ModifyRunAnimation(nullptr),
NonInputAnimState(ENonInputAnimState::None)
{
}
void UPlayerCharacterAnimInstance::SetDefaultProperty(AActor* InOwner)
{
ACorePlayerCharacter* LocOwnerCharacter = Cast<ACorePlayerCharacter>(InOwner);
if(!LocOwnerCharacter) return;
OwnerPlayerCharacter = LocOwnerCharacter;
UAnimMontage* LocPlayerActionMontage;
OwnerPlayerCharacter->GetActionMontage(LocPlayerActionMontage);
SetActionMontage(LocPlayerActionMontage);
TObjectPtr<UAnimSequence> LocSetSequence = nullptr;
OwnerPlayerCharacter->GetIdleAnimSequence(LocSetSequence);
if(LocSetSequence) PlayerIdleAnimation = LocSetSequence;
OwnerPlayerCharacter->GetRestAnimSequence(LocSetSequence);
if(LocSetSequence) PlayerRestAnimation = LocSetSequence;
OwnerPlayerCharacter->GetMoveAnimSequence(LocSetSequence);
if(LocSetSequence) PlayerMoveAnimation = LocSetSequence;
OwnerPlayerCharacter->GetRunAnimSequence(LocSetSequence);
if(LocSetSequence) PlayerRunAnimation = LocSetSequence;
}
void UPlayerCharacterAnimInstance::SetModifyAnimation(const TObjectPtr<UAnimSequence>& InIdleSequence, const TObjectPtr<UAnimSequence>& InMoveSequence, const TObjectPtr<UAnimSequence>& InRunSequence)
{
InIdleSequence? ModifyIdleAnimation = InIdleSequence : ModifyIdleAnimation = PlayerIdleAnimation;
InMoveSequence? ModifyMoveAnimation = InMoveSequence : ModifyMoveAnimation = PlayerMoveAnimation;
InRunSequence? ModifyRunAnimation = InRunSequence : ModifyRunAnimation = PlayerRunAnimation;
}
void UPlayerCharacterAnimInstance::SetActionMontage(UAnimMontage* InSetActionMontage)
{
if(InSetActionMontage) PlayerActionMontage = InSetActionMontage;
}
void UPlayerCharacterAnimInstance::SetNonInputAnimState(ENonInputAnimState InSetState)
{
OwnerPlayerCharacter->SetInputable(false);
bool LocbChangeState = true;
switch(InSetState)
{
case ENonInputAnimState::Tired:
{
LocbChangeState = false;
NonInputAnimState = InSetState;
OwnerPlayerCharacter->SetInputable(true);
break;
}
case ENonInputAnimState::HitBack:
{
LocbChangeState = !(NonInputAnimState == ENonInputAnimState::JumpBackStart ||
NonInputAnimState == ENonInputAnimState::JumpBackLoop ||
NonInputAnimState == ENonInputAnimState::JumpBackEnd ||
NonInputAnimState == ENonInputAnimState::GetUp ||
NonInputAnimState == ENonInputAnimState::Dead);
break;
}
case ENonInputAnimState::JumpBackStart:
{
LocbChangeState = !(NonInputAnimState == ENonInputAnimState::JumpBackStart ||
NonInputAnimState == ENonInputAnimState::JumpBackLoop ||
NonInputAnimState == ENonInputAnimState::JumpBackEnd ||
NonInputAnimState == ENonInputAnimState::GetUp ||
NonInputAnimState == ENonInputAnimState::Dead);
break;
}
case ENonInputAnimState::JumpBackLoop: break;
case ENonInputAnimState::JumpBackEnd: break;
case ENonInputAnimState::GetUp: break;
case ENonInputAnimState::Stun: break;
case ENonInputAnimState::Dead: break;
case ENonInputAnimState::Defeat: break;
case ENonInputAnimState::Victory: break;
default: NMT_LOG("Non Input Anim state Invalid"); break;
}
if(LocbChangeState)
{
bPlayerInputable = false;
NonInputAnimState = InSetState;
}
}
void UPlayerCharacterAnimInstance::StateChangeTest()
{
}
void UPlayerCharacterAnimInstance::NonInputAnimFinished()
{
switch(NonInputAnimState)
{
case ENonInputAnimState::Tired:
{
NonInputAnimState = ENonInputAnimState::None;
break;
}
case ENonInputAnimState::HitBack:
{
OwnerPlayerCharacter->SetInputable(true);
bPlayerInputable = true;
NonInputAnimState = ENonInputAnimState::None;
break;
}
case ENonInputAnimState::JumpBackStart: break;
case ENonInputAnimState::JumpBackLoop: break;
case ENonInputAnimState::JumpBackEnd:
{
SetNonInputAnimState(ENonInputAnimState::GetUp);
break;
}
case ENonInputAnimState::GetUp:
{
bPlayerInputable = true;
NonInputAnimState = ENonInputAnimState::None;
OwnerPlayerCharacter->SetInputable(true);
OwnerPlayerCharacter->SetInvincible(false);
break;
}
case ENonInputAnimState::Stun: break;
case ENonInputAnimState::Dead: break;
case ENonInputAnimState::Defeat: break;
case ENonInputAnimState::Victory: break;
default: NMT_LOG("Non Input Anim state Invalid"); break;
}
}

View File

@ -0,0 +1,107 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimInstance.h"
#include "PlayerCharacterAnimInstance.generated.h"
UENUM(BlueprintType)
enum class ENonInputAnimState: uint8
{
None = 0 UMETA(DisplayName = "None"),
Tired UMETA(DisplayName = "Tired"),
HitBack UMETA(DisplayName = "HitBack"),
JumpBackStart UMETA(DisplayName = "JumpBackStart"),
JumpBackLoop UMETA(DisplayName = "JumpBackLoop"),
JumpBackEnd UMETA(DisplayName = "JumpBackEnd"),
GetUp UMETA(DisplayName = "GetUp"),
Stun UMETA(DisplayName = "Stun"),
Dead UMETA(DisplayName = "Dead"),
Defeat UMETA(DisplayName = "Defeat"),
Victory UMETA(DisplayName = "Victory")
};
UCLASS()
class PROJECTT_API UPlayerCharacterAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
UPlayerCharacterAnimInstance();
void SetDefaultProperty(AActor* InOwner);
void SetActionState(const bool InbActivate) { bAction = InbActivate; }
void SetModifyState(const bool InbModify) { bModify = InbModify; }
void NonInputAnimFinished();
void GetCommonMontage(UAnimMontage*& OutCommonMontage) const { OutCommonMontage = PlayerCommonMontage; }
void SetModifyAnimation(const TObjectPtr<UAnimSequence>& InIdleSequence = nullptr, const TObjectPtr<UAnimSequence>& InMoveSequence = nullptr,
const TObjectPtr<UAnimSequence>& InRunSequence = nullptr);
ENonInputAnimState GetCurrentNonInputState() { return NonInputAnimState; }
FORCEINLINE ENonInputAnimState GetCurrentNonInputState() const { return NonInputAnimState; }
UFUNCTION(BlueprintCallable)
void SetActionMontage(UAnimMontage* InSetActionMontage);
UFUNCTION(BlueprintCallable)
void SetNonInputAnimState(ENonInputAnimState InSetState);
UFUNCTION(BlueprintCallable)
void StateChangeTest();
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class ACorePlayerCharacter* OwnerPlayerCharacter;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
bool bPlayerInputable;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
bool bIdle;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
bool bRest;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
bool bWalk;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
bool bRun;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
bool bAction;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
bool bModify;
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimMontage> PlayerActionMontage;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimMontage> PlayerCommonMontage;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> PlayerIdleAnimation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> PlayerRestAnimation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> PlayerMoveAnimation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> PlayerRunAnimation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> ModifyIdleAnimation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> ModifyMoveAnimation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> ModifyRunAnimation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
ENonInputAnimState NonInputAnimState;
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,360 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GenericTeamAgentInterface.h"
#include "ProjectT/System/Core/Characters/CombatCharacter.h"
#include "ProjectT/ProjectT.h"
#include "ProjectT/Data/Gen/GenerateEnumContentType.h"
#include "ProjectT/Data/Gen/GenerateStructPlayerCharacter.h"
#include "ProjectT/System/Core/Interfaces/Damageable.h"
#include "ProjectT/Data/Player/PlayerDataModel.h"
#include "CorePlayerCharacter.generated.h"
struct FInputActionValue;
class UInputAction;
class UInputMappingContext;
class UCoreCameraComponent;
class USpringArmComponent;
DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnRequestInteractIcon, const FString&, ThumnailPath, const bool, bVisibility);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FItemSlotActivate, const int&, SlotNumber, const bool, bActivate);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FSkillCoolTime, TSubclassOf<class ACoreSkill>, SkillClass, float, RemainTimeRatio, bool, bCoolDownComplete);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FEffectTime, EEffectSubTypes, EffectSubTypes, float, RemainTimeRatio, bool, bEffectRecover);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FInteractionIconVisibility, bool, bVisible);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPlayerDeadDone);
UCLASS()
class PROJECTT_API ACorePlayerCharacter : public ACombatCharacter, public IGenericTeamAgentInterface, public IDamageable
{
GENERATED_BODY()
CONTENT_TYPE_NUMBER(EContentType::PlayerCharacter)
public:
ACorePlayerCharacter();
virtual FGenericTeamId GetGenericTeamId() const override { return FGenericTeamId(1); }
virtual void PostLoad() override;
virtual void OnConstruction(const FTransform& Transform) override;
virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override;
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
virtual void ApplyDamageEvent_Implementation(AActor* InOccurActor, const FVector& InOriginLocation, const float InDamage, const TArray<FEffect>& InSkillEffects) override;
virtual void ApplyRecoveryEvent_Implementation(const TArray<FEffect>& InReleaseEffects) override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
void SetupPlayerInputActions();
void SetCurrentSkill(bool InbSet, ACoreSkill* InSetSkill = nullptr);
void PlayActionMontage(FName InSectionName, FOnMontageEnded InEndedFunction = nullptr, FOnMontageBlendingOutStarted InBlendOutFunction = nullptr) const;
void PlayCommonMontage(FName InSectionName, FOnMontageEnded InEndedFunction = nullptr, FOnMontageBlendingOutStarted InBlendOutFunction = nullptr) const;
void StopActionMontage() const;
void SetUnDetectState(bool InbUnDetect);
void SetSlotCursor(int InSetSlotCursor);
void GetAudioListener(USceneComponent*& OutAudioListener);
void GetCameraComponent(TObjectPtr<UCoreCameraComponent>& OutCoreCameraComponent) const { OutCoreCameraComponent = CoreCameraComponent; }
void GetAnimInstance(class UPlayerCharacterAnimInstance*& OutAnimInstance) const { OutAnimInstance = PlayerAnimInstance; }
void GetCurrentSkill(ACoreSkill*& OutCurrentSkill) const { OutCurrentSkill = CurrentUsingSkill; }
void GetInvincible(bool& OutbInvincible) const { OutbInvincible = bInvincible; }
void GetSkillClass(TSubclassOf<AActor>& OutAtkSkillClass, TSubclassOf<AActor>& OutSkillClass) const;
void GetActionMontage(UAnimMontage*& OutActionMontage) const { OutActionMontage = ActionMontage; }
void GetIdleAnimSequence(TObjectPtr<UAnimSequence>& OutIdleAnimSequence) const { OutIdleAnimSequence = IdleAnimation; }
void GetRestAnimSequence(TObjectPtr<UAnimSequence>& OutIdleAnimSequence) const { OutIdleAnimSequence = RestAnimation; }
void GetMoveAnimSequence(TObjectPtr<UAnimSequence>& OutMoveAnimSequence) const { OutMoveAnimSequence = MoveAnimation; }
void GetRunAnimSequence(TObjectPtr<UAnimSequence>& OutRunAnimSequence) const { OutRunAnimSequence = RunAnimation; }
void GetPlayerCharacterData(FPlayerCharacter& OutPlayerCharacterData) const;
void GetUnDetectState(bool& OutUnDetect) const { OutUnDetect = bUnDetect; }
void GetSlotCursor(int& OutCurrentCursor) const { OutCurrentCursor = CurrentSlotCursor; }
FORCEINLINE class UPlayerInventoryComponent* GetPlayerInventory() { return PlayerInventoryComponent; }
FORCEINLINE class UPlayerStatusComponent* GetPlayerStatus() { return PlayerStatusComponent; }
UFUNCTION(BlueprintCallable)
void SetInputable(bool InbEnable);
UFUNCTION(BlueprintCallable)
void SetInvincible(bool InbInvincible);
UFUNCTION(BlueprintNativeEvent)
void StartCountDown();
UFUNCTION()
void EventOnDead();
//FIXME: 임시용 상호작용 불가능 아이콘 표시를 띄우기 위한 델리게이트 추가
UFUNCTION(BlueprintCallable)
void UpdateRequestInteractionIcon(const FOnRequestInteractIcon& Callback);
protected:
#if WITH_EDITOR
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
virtual void ApplyCharacterData(const FTableRowBase* RowData) override;
#endif
virtual void SetSkillState(EPlayerSkillState InSkillState, FSkill InSkillData = FSkill());
virtual void SetMeleeAtkSkillState(EPlayerSkillState InSkillState, FSkill InSkillData = FSkill());
virtual void SetItemSkillState(EPlayerSkillState InSkillState, FSkill InSkillData = FSkill());
void InitPlayerCharacter();
void InitializeProperty();
void SetSkillClass();
void AxisMoveStarted();
void AxisMoveTriggered(const FInputActionValue& Value);
void AxisMoveCompleted();
void RunTriggered(const FInputActionValue& Value);
virtual void ChangeValueOnRun(bool InbRun);
void RunCompleted();
void ActivateMeleeAttack();
void ActivateSkill();
void ActivateItemSkill(int InCurrentInput, int InItemSkillId);
void InteractionStarted();
void InteractionCompleted();
void UseItemSlot1();
void UseItemSlot2();
void UseItemSlot3();
void ToggleGameMenu();
void DebugToggleCheat(const FInputActionValue& InputActionValue);
void DebugToggleInvincible(const FInputActionValue& InputActionValue);
void DebugTogglePlayerDamage(const FInputActionValue& InputActionValue);
void DebugTogglePlayerSpeed(const FInputActionValue& InputActionValue);
void DebugToggleFrustum(const FInputActionValue& InputActionValue);
void DebugToggleHitCollision(const FInputActionValue& InputActionValue);
void DebugToggleTimeStop(const FInputActionValue& InputActionValue);
void DebugToggleSlomo(const FInputActionValue& InputActionValue);
void DebugCharacterSelect(const FInputActionValue& InputActionValue);
void DebugToggleSpectatorPawn(const FInputActionValue& InputActionValue);
void RespawnCharacter();
void AppearPlayerCharacter();
void SetSkillCoolTime(const TSubclassOf<AActor>& InSkillClass, const FSkill& InSkillData);
void SkillCoolTimeDown();
bool CheckEffectTime(const FEffect& InEffect);
void AddEffectTimeMap(const FEffect& InEffect);
void EffectTimeDown();
void RecoverStamina();
void DecreaseStamina();
void SetActorRotationToMouseCursor();
void RotateMeshToMouseCursor();
virtual void RotateMeshAxisForward(bool InbMove);
bool CheckSkillCalibrateRange(const FSkill& InSkillData, AActor*& OutNearActor) const;
void CalibrateMeshNearActor(const AActor* InNearActor);
void CalibrateMeshMouseCursor();
void CalibrateMeshAxisForward();
void CheckClosestObject();
void CheckPlayerFalling();
void ActivateNoiseFX(bool InActivate);
void StatusSlow(float InSlowValue, bool InbRecovery = false) const;
void StatusFast(float InFastValue, bool InbRecovery = false) const;
void StartMouseCursorLinear(bool InbStart, bool InbSustain = true);
void StartMouseCursorParabola(bool InbStart, bool InbSustain = true, bool InbPathVisible = true);
UFUNCTION(BlueprintCallable)
void RestTimerStart();
UFUNCTION(BlueprintCallable)
void RefreshRestTime();
UFUNCTION(BlueprintCallable)
void PlayerJumpBack(AActor* InOccurActor);
UFUNCTION()
void ResetCharacterData();
UFUNCTION()
void InteractionAreaBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
UFUNCTION()
void InteractionAreaEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
UFUNCTION()
void NoiseAreaBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
UFUNCTION()
void NoiseAreaEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
UFUNCTION(BlueprintCallable)
void SetDecreaseStaminaTimer(bool InbDecrease);
private:
void InitializeCharacterSet();
public:
//FIXME: 임시용 상호작용 불가능 아이콘 표시를 띄우기 위한 델리게이트 추가
UPROPERTY()
FOnRequestInteractIcon OnRequestInteractIcon;
UPROPERTY(BlueprintAssignable)
FInteractionIconVisibility RefreshInteractionVisibility;
UPROPERTY(BlueprintAssignable)
FPlayerDeadDone PlayerDeadDone;
UPROPERTY(BlueprintAssignable)
FSkillCoolTime RefreshSkillCoolTime;
UPROPERTY(BlueprintAssignable)
FEffectTime RefreshEffectTime;
UPROPERTY(BlueprintAssignable)
FItemSlotActivate ItemSlotActivate;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly,Category = PlayerSkill, meta = (AllowPrivateAccess = "true"))
TObjectPtr<USceneComponent> SkillRootScene;
protected:
FRotator MovingActionForward;
FRotator MouseCursorRotation;
bool bInvincible;
bool bDead;
float CalibrateYawValue;
float RestTime;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = PlayerAnimation, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UAnimMontage> ActionMontage;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = PlayerAnimation, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UAnimSequence> IdleAnimation;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = PlayerAnimation, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UAnimSequence> RestAnimation;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = PlayerAnimation, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UAnimSequence> MoveAnimation;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = PlayerAnimation, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UAnimSequence> RunAnimation;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TObjectPtr<class UPlayerStatusComponent> PlayerStatusComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TObjectPtr<class UPlayerInventoryComponent> PlayerInventoryComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TObjectPtr<USceneComponent> AudioListener;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = PlayerAnimation, meta = (AllowPrivateAccess = "true"))
UPlayerCharacterAnimInstance* PlayerAnimInstance;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = PlayerAnimation, meta = (AllowPrivateAccess = "true"))
TObjectPtr<class UPoseableMeshComponent> TransformMeshComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Interaction, meta = (AllowPrivateAccess = "true"))
TObjectPtr<class USphereComponent> InteractionAreaCollision;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Interaction, meta = (AllowPrivateAccess = "true"))
TObjectPtr<USphereComponent> NoiseAreaCollision;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Interaction, meta = (AllowPrivateAccess = "true"))
TObjectPtr<USphereComponent> SkillCalibrateAreaCollision;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
TObjectPtr<USpringArmComponent> CameraBoom;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UCoreCameraComponent> CoreCameraComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
TObjectPtr<UInputMappingContext> DefaultMappingContext;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TObjectPtr<class UNiagaraComponent> RunFXComponent;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TObjectPtr<UNiagaraComponent> NoiseFXComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TObjectPtr<ACoreSkill> CurrentUsingSkill;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TObjectPtr<AActor> InteractableObject;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input)
FPlayerActionTypes PlayerActions;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input)
FPlayerDebugActionTypes PlayerDebugActions;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input)
FPlayerChordedActionTypes PlayerChordedActions;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input)
float AxisMoveSpeed;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FVector2D CharacterMoveAxis;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
bool bInputAble;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
bool bUnDetect;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
int CurrentSlotCursor;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
FPlayerCharacter CurrentPlayerData;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TMap<TSubclassOf<ACoreSkill>, FPlayerSimpleRatio> SkillCoolTimeMap;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TMap<EEffectSubTypes, FPlayerEffectValue> EffectTimeMap;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TSubclassOf<ACoreSkill> PlayerAtkSkillClass;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerStatus, meta = (AllowPrivateAccess = "true"))
TSubclassOf<ACoreSkill> PlayerSkillClass;
UPROPERTY()
class ACorePlayerController* CorePlayerController;
UPROPERTY()
TArray<EEffectSubTypes> ContainEffects;
UPROPERTY()
FTimerHandle SkillCoolDownTimerHandle;
UPROPERTY()
FTimerHandle EffectActiveTimerHandle;
UPROPERTY()
FTimerHandle ClosestObjectTimerHandle;
UPROPERTY()
FTimerHandle DecreaseStaminaTimerHandle;
UPROPERTY()
FTimerHandle RecoverStaminaTimerHandle;
UPROPERTY()
FTimerHandle MeshRotateCalibrateTimerHandle;
UPROPERTY()
FTimerHandle FadeTimerHandle;
UPROPERTY()
FTimerHandle JumpBackTimerHandle;
UPROPERTY()
FTimerHandle MouseCursorTimerHandle;
UPROPERTY()
FTimerHandle RestTimerHandle;
UPROPERTY()
UEnhancedInputComponent* CurrentEnhancedInputComponent;
UPROPERTY(EditDefaultsOnly, Category = "MovingAction")
bool bMovingAction;
UPROPERTY(EditDefaultsOnly, Category = "MovingAction")
float MeleeAtkDecreaseSpeedRatio;
UPROPERTY(EditDefaultsOnly, Category = "MovingAction")
float SkillDecreaseSpeedRatio;
UPROPERTY(EditDefaultsOnly, Category = "Skill")
bool bCalibrateSkill;
};

View File

@ -0,0 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SkillObjectAnimInstance.h"
USkillObjectAnimInstance::USkillObjectAnimInstance() :
ObjectMontage(nullptr),
ObjectIdleAnimation(nullptr)
{
}
void USkillObjectAnimInstance::SetDefaultProperty(TObjectPtr<UAnimSequence> InIdleSequence, TObjectPtr<UAnimMontage> InObjectMontage)
{
if(InIdleSequence)
{
ObjectIdleAnimation = InIdleSequence;
}
if(InObjectMontage)
{
ObjectMontage = InObjectMontage;
}
}

View File

@ -0,0 +1,28 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimInstance.h"
#include "SkillObjectAnimInstance.generated.h"
/**
*
*/
UCLASS()
class PROJECTT_API USkillObjectAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
USkillObjectAnimInstance();
void SetDefaultProperty(TObjectPtr<UAnimSequence> InIdleSequence, TObjectPtr<UAnimMontage> InObjectMontage);
TObjectPtr<UAnimMontage> GetSkillObjectMontage() { return ObjectMontage; }
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimMontage> ObjectMontage;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerAnimationState)
TObjectPtr<UAnimSequence> ObjectIdleAnimation;
};

View File

@ -0,0 +1,277 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CoreSkill.h"
#include "NiagaraComponent.h"
#include "NiagaraSystem.h"
#include "Components/SphereComponent.h"
#include "Kismet/KismetMathLibrary.h"
#include "ProjectT/Data/Gen/GenerateEnumDataTableKey.h"
#include "ProjectT/System/Core/Characters/NPC/CoreNpc.h"
#include "ProjectT/System/Core/Characters/Player/CorePlayerCharacter.h"
#include "ProjectT/System/Core/Common/AssetUtilsLibrary.h"
#include "ProjectT/System/Core/Common/GlobalUtilsLibrary.h"
#include "ProjectT/System/Core/GameModes/WorldGameMode.h"
#include "ProjectT/System/Core/Managers/CoreCheatManager.h"
#include "ProjectT/System/Core/Managers/PooledActorManager.h"
ACoreSkill::ACoreSkill():
SkillRowName(TEXT("None")),
RootSceneComponent(nullptr),
NoiseSphereComponent(nullptr),
HitFXSystem(nullptr),
NoiseFXComponent(nullptr),
SkillPoolsize(10),
SkillOwner(nullptr),
SkillId(0),
bAimState(false),
bCanceled(false),
bReleased(false),
bActivated(false),
BodyHitComponent(nullptr),
RangeHitComponent(nullptr)
{
PrimaryActorTick.bCanEverTick = true;
RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootSceneComponent"));
NoiseSphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("NoiseSphereComponent"));
NoiseFXComponent = CreateDefaultSubobject<UNiagaraComponent>(TEXT("NoiseFXComponent"));
RootComponent = RootSceneComponent;
NoiseSphereComponent->SetupAttachment(RootSceneComponent);
NoiseSphereComponent->SetCollisionProfileName(TEXT("PlayerHit"));
NoiseSphereComponent->SetCollisionEnabled(ECollisionEnabled::Type::NoCollision);
NoiseFXComponent->SetupAttachment(NoiseSphereComponent);
NoiseFXComponent->bAutoActivate = false;
}
void ACoreSkill::InitializeSkillData()
{
if(SkillRowName.IsNone()) return;
LinearTraceQuery = UEngineTypes::ConvertToTraceType(ECC_GameTraceChannel3);
UDataTable* LocDataTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::Skill);
FSkill* LocSkillDataRow = LocDataTable->FindRow<FSkill>(SkillRowName, TEXT("Not Found FSkill"));
if(!NMT_ENSURE(LocSkillDataRow)) return;
SkillData = *LocSkillDataRow;
TArray<int32> LocEffectArray;
if(SkillData.iEffect1Id != 0) LocEffectArray.Add(SkillData.iEffect1Id);
if(SkillData.iEffect2Id != 0) LocEffectArray.Add(SkillData.iEffect2Id);
if(SkillData.iEffect3Id != 0) LocEffectArray.Add(SkillData.iEffect3Id);
if(LocEffectArray.Num() > 0)
for(int32 LocEffectID : LocEffectArray)
{
FName LocEffectRowName = *FString::FromInt(LocEffectID);
LocDataTable = UAssetUtilsLibrary::LoadDataTableByEnumKey(EDataTableKey::Effect);
FEffect* LocEffectDataRow = LocDataTable->FindRow<FEffect>(LocEffectRowName, TEXT("Not Found FSkill"));
SkillEffects.Add(*LocEffectDataRow);
}
NoiseSphereComponent->SetSphereRadius(SkillData.fSkillNoise);
//TODO : Load Relative Path From Table After Added
if(UNiagaraSystem* LocFindNoiseAsset = Cast<UNiagaraSystem>(StaticLoadObject(UNiagaraSystem::StaticClass(),nullptr,TEXT("/Script/Niagara.NiagaraSystem'/Game/FX/NiagaraSystem/Common/NS_Common_SoundEangeEffects.NS_Common_SoundEangeEffects'"))))
NoiseFXComponent->SetAsset(LocFindNoiseAsset);
if(UNiagaraSystem* LocFindNoiseAsset = Cast<UNiagaraSystem>(StaticLoadObject(UNiagaraSystem::StaticClass(),nullptr,TEXT("/Script/Niagara.NiagaraSystem'/Game/FX/NiagaraSystem/Common/NS_Common_Hit.NS_Common_Hit'"))))
HitFXSystem = LocFindNoiseAsset;
}
void ACoreSkill::SetSkillOwner(AActor* InSkillOwner)
{
SkillOwner = InSkillOwner;
}
void ACoreSkill::GetSkillData(FSkill& OutCurrentSkillData)
{
OutCurrentSkillData = SkillData;
}
float ACoreSkill::GetFinalDamage(AActor* InHitActor, bool InbLocationSelf)
{
float LocFinalDamage = 0.f;
if(SkillOwner)
{
ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(SkillOwner);
FVector2D LocOccurForward;
InbLocationSelf ? LocOccurForward = FVector2D(InHitActor->GetActorLocation().X - GetActorLocation().X, InHitActor->GetActorLocation().Y - GetActorLocation().Y)
: LocOccurForward = FVector2D(LocPlayerCharacter->GetMesh()->GetForwardVector().X, LocPlayerCharacter->GetMesh()->GetForwardVector().Y);
FVector2D LocNpcForward(InHitActor->GetActorForwardVector().X,InHitActor->GetActorForwardVector().Y);
float LocDotValue = UKismetMathLibrary::DotProduct2D(LocOccurForward,LocNpcForward);
if(LocDotValue >= 0)
SkillData.fCriDmg <= 0.f ? LocFinalDamage = SkillData.fDamage : LocFinalDamage = SkillData.fCriDmg;
else
LocFinalDamage = SkillData.fDamage;
}
return LocFinalDamage;
}
void ACoreSkill::SetParabolaLaunchVelocity()
{
FVector LocEndPoint = CursorCalibrateHitResult.Location;
FVector LocCalibLocation(GetActorLocation().X, GetActorLocation().Y, LocEndPoint.Z);
float LocFinalDistance = FVector::Distance(LocCalibLocation, LocEndPoint);
UGlobalUtilsLibrary::SuggestProjectileVelocityAtLocation(GetWorld(), LaunchVelocity, GetActorLocation(),
LocEndPoint, 110.f, 0.f,
LocFinalDistance / 100.f);
}
UPrimitiveComponent* ACoreSkill::GetBodyHitComponent() const
{
return BodyHitComponent;
}
UPrimitiveComponent* ACoreSkill::GetRangeHitComponent() const
{
return RangeHitComponent;
}
void ACoreSkill::StartSkill()
{
}
void ACoreSkill::AimSkill()
{
}
void ACoreSkill::ActivateSkill()
{
}
void ACoreSkill::ReleaseSkill()
{
}
void ACoreSkill::CancelSkill()
{
}
void ACoreSkill::FinishSkill()
{
UWorld* World = UGlobalUtilsLibrary::GetValidWorld(this);
AWorldGameMode* LocGameMode = UGlobalUtilsLibrary::GetGameModeChecked<AWorldGameMode>(World);
UPooledActorManager* LocPoolManager = IWorldObjectProvider::Execute_GetPooledActorManager(LocGameMode);
if(LocPoolManager)
{
LocPoolManager->Push(this);
}
}
void ACoreSkill::SkillHitEnable(bool InbEnable)
{
}
void ACoreSkill::SkillObjectHitEnable(bool InbEnable)
{
}
void ACoreSkill::SkillFXEnable(bool InbEnable, int32 InIndex)
{
}
void ACoreSkill::MakeSkillNoise(bool InbLocationSelf, UPrimitiveComponent* InAttachedComponent)
{
if(SkillData.fSkillNoise == 0) return;
if(InbLocationSelf)
{
if(InAttachedComponent != nullptr)
{
NoiseFXComponent->AttachToComponent(InAttachedComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
}
}
else
{
if(ACorePlayerCharacter* LocPlayerCharacter = Cast<ACorePlayerCharacter>(SkillOwner))
{
NoiseFXComponent->AttachToComponent(LocPlayerCharacter->GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale);
}
}
NoiseFXComponent->Activate(true);
NoiseFXComponent->SetFloatParameter(TEXT("Wave Radius"), SkillData.fSkillNoise * 2.f);
NoiseSphereComponent->SetSphereRadius(SkillData.fSkillNoise);
NoiseSphereComponent->SetCollisionEnabled(ECollisionEnabled::Type::QueryOnly);
TArray<AActor*> OverlappedActors;
NoiseSphereComponent->GetOverlappingActors(OverlappedActors, ACoreNpc::StaticClass());
TArray<AActor*> LocIgnoreActors;
if(OverlappedActors.Num() >= 1)
{
for(AActor* LocOverlapActor : OverlappedActors)
{
if(ACoreNpc* LocOverlapNpc = Cast<ACoreNpc>(LocOverlapActor))
{
LocOverlapNpc->SetDetectLocationFromNoise(GetActorLocation());
}
}
}
NoiseSphereComponent->SetCollisionEnabled(ECollisionEnabled::Type::NoCollision);
}
void ACoreSkill::ResetDefaultState()
{
}
void ACoreSkill::MovedComponentToHitPoint(AActor* InHitActor, UPrimitiveComponent* InMovedComponent)
{
TArray<AActor*> LocIgnoreActors;
LocIgnoreActors.Add(SkillOwner);
FHitResult LocTraceHitResult;
UKismetSystemLibrary::LineTraceSingle(this, GetActorLocation(), InHitActor->GetActorLocation(),
TraceTypeQuery1, false, LocIgnoreActors, EDrawDebugTrace::None, LocTraceHitResult, true);
if(LocTraceHitResult.bBlockingHit)
{
InMovedComponent->SetWorldLocation(LocTraceHitResult.Location);
}
}
void ACoreSkill::BeginPlay()
{
Super::BeginPlay();
}
void ACoreSkill::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ACoreSkill::Enable_Implementation()
{
IPoolableActor::Enable_Implementation();
}
void ACoreSkill::Disable_Implementation()
{
IPoolableActor::Disable_Implementation();
if(UCoreCheatManager* CCM = UGlobalUtilsLibrary::GetSharedCoreCheatManager(this))
{
if(CCM->GetDebugStatus().bDebugHitCollision)
{
if(BodyHitComponent) BodyHitComponent->SetHiddenInGame(true);
if(RangeHitComponent) RangeHitComponent->SetHiddenInGame(true);
}
}
}
void ACoreSkill::Pushed_Implementation()
{
IPoolableActor::Pushed_Implementation();
}
void ACoreSkill::Obtained_Implementation()
{
IPoolableActor::Obtained_Implementation();
if(UCoreCheatManager* CCM = UGlobalUtilsLibrary::GetSharedCoreCheatManager(this))
{
if(CCM->GetDebugStatus().bDebugHitCollision)
{
BodyHitComponent->SetHiddenInGame(false);
RangeHitComponent->SetHiddenInGame(false);
}
}
}
void ACoreSkill::RefreshCursorHitResult_Implementation(FHitResult InHitResult)
{
IMouseInteraction::RefreshCursorHitResult_Implementation(InHitResult);
CursorCalibrateHitResult = InHitResult;
}

Some files were not shown because too many files have changed in this diff Show More