mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-05 15:18:47 +00:00
simplify integration
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
"Enabled": true
|
"Enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "CogInterface",
|
"Name": "CogCommon",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class CogAbility : ModuleRules
|
|||||||
{
|
{
|
||||||
"Core",
|
"Core",
|
||||||
"CogImgui",
|
"CogImgui",
|
||||||
"CogInterface",
|
"CogCommon",
|
||||||
"CogDebug",
|
"CogDebug",
|
||||||
"CogWindow",
|
"CogWindow",
|
||||||
"GameplayAbilities",
|
"GameplayAbilities",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "AbilitySystemGlobals.h"
|
#include "AbilitySystemGlobals.h"
|
||||||
#include "CogAbilityDataAsset_Cheats.h"
|
#include "CogAbilityDataAsset_Cheats.h"
|
||||||
#include "CogAbilityReplicator.h"
|
#include "CogAbilityReplicator.h"
|
||||||
#include "CogInterfaceAllegianceActor.h"
|
#include "CogCommonAllegianceActorInterface.h"
|
||||||
#include "CogDebugDraw.h"
|
#include "CogDebugDraw.h"
|
||||||
#include "CogImguiHelper.h"
|
#include "CogImguiHelper.h"
|
||||||
#include "EngineUtils.h"
|
#include "EngineUtils.h"
|
||||||
@@ -252,15 +252,15 @@ void UCogAbilityWindow_Cheats::RequestCheat(AActor* ControlledActor, AActor* Sel
|
|||||||
{
|
{
|
||||||
if (AActor* OtherActor = *It)
|
if (AActor* OtherActor = *It)
|
||||||
{
|
{
|
||||||
ECogInterfacesAllegiance Allegiance = ECogInterfacesAllegiance::Enemy;
|
ECogCommonAllegiance Allegiance = ECogCommonAllegiance::Enemy;
|
||||||
|
|
||||||
if (ICogInterfacesAllegianceActor* AllegianceInterface = Cast<ICogInterfacesAllegianceActor>(OtherActor))
|
if (ICogCommonAllegianceActorInterface* AllegianceInterface = Cast<ICogCommonAllegianceActorInterface>(OtherActor))
|
||||||
{
|
{
|
||||||
AllegianceInterface->GetAllegianceWithOtherActor(ControlledActor);
|
AllegianceInterface->GetAllegianceWithOtherActor(ControlledActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((IsShiftDown && (Allegiance == ECogInterfacesAllegiance::Enemy))
|
if ((IsShiftDown && (Allegiance == ECogCommonAllegiance::Enemy))
|
||||||
|| (IsAltDown && (Allegiance == ECogInterfacesAllegiance::Friendly)))
|
|| (IsAltDown && (Allegiance == ECogCommonAllegiance::Friendly)))
|
||||||
{
|
{
|
||||||
Actors.Add(OtherActor);
|
Actors.Add(OtherActor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"FileVersion": 1,
|
"FileVersion": 1,
|
||||||
"Version": 1,
|
"Version": 1,
|
||||||
"VersionName": "1.0",
|
"VersionName": "1.0",
|
||||||
"FriendlyName": "CogInterface",
|
"FriendlyName": "CogCommon",
|
||||||
"Description": "",
|
"Description": "",
|
||||||
"Category": "Other",
|
"Category": "Other",
|
||||||
"CreatedBy": "Arnaud Jamin",
|
"CreatedBy": "Arnaud Jamin",
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
"Installed": false,
|
"Installed": false,
|
||||||
"Modules": [
|
"Modules": [
|
||||||
{
|
{
|
||||||
"Name": "CogInterface",
|
"Name": "CogCommon",
|
||||||
"Type": "Runtime",
|
"Type": "Runtime",
|
||||||
"LoadingPhase": "Default"
|
"LoadingPhase": "Default"
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
|
|
||||||
public class CogInterface : ModuleRules
|
public class CogCommon : ModuleRules
|
||||||
{
|
{
|
||||||
public CogInterface(ReadOnlyTargetRules Target) : base(Target)
|
public CogCommon(ReadOnlyTargetRules Target) : base(Target)
|
||||||
{
|
{
|
||||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
+5
-5
@@ -1,17 +1,17 @@
|
|||||||
#include "CogInterfaceModule.h"
|
#include "CogCommonModule.h"
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "FCogInterfacesModule"
|
#define LOCTEXT_NAMESPACE "FCogCommonModule"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogInterfaceModule::StartupModule()
|
void FCogCommonModule::StartupModule()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogInterfaceModule::ShutdownModule()
|
void FCogCommonModule::ShutdownModule()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef LOCTEXT_NAMESPACE
|
#undef LOCTEXT_NAMESPACE
|
||||||
|
|
||||||
IMPLEMENT_MODULE(FCogInterfaceModule, CogInterface)
|
IMPLEMENT_MODULE(FCogCommonModule, CogCommon)
|
||||||
+22
-11
@@ -1,19 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogDebugDefines.h"
|
|
||||||
#include "CogDebugSettings.h"
|
|
||||||
#include "Templates/IsArrayOrRefOfType.h"
|
#include "Templates/IsArrayOrRefOfType.h"
|
||||||
|
|
||||||
#if !ENABLE_COG
|
#ifndef ENABLE_COG
|
||||||
|
#define ENABLE_COG !UE_BUILD_SHIPPING
|
||||||
|
#endif
|
||||||
|
|
||||||
#define COG_LOG_ACTIVE_FOR_OBJECT(Object) (0)
|
#if ENABLE_COG
|
||||||
#define COG_LOG(LogCategory, Verbosity, Format, ...) (0)
|
|
||||||
#define COG_LOG_FUNC(LogCategory, Verbosity, Format, ...) (0)
|
|
||||||
#define COG_LOG_OBJECT(LogCategory, Verbosity, Actor, Format, ...) (0)
|
|
||||||
#define COG_LOG_OBJECT_NO_CONTEXT(LogCategory, Verbosity, Actor, Format, ...) (0)
|
|
||||||
|
|
||||||
#else //!ENABLE_COG
|
#include "CogDebugSettings.h"
|
||||||
|
|
||||||
|
#define IF_COG(expr) { expr; }
|
||||||
|
#define COG_LOG_CATEGORY FLogCategoryBase
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
#define COG_LOG_ACTIVE_FOR_OBJECT(Object) (FCogDebugSettings::IsDebugActiveForObject(Object))
|
#define COG_LOG_ACTIVE_FOR_OBJECT(Object) (FCogDebugSettings::IsDebugActiveForObject(Object))
|
||||||
@@ -49,5 +48,17 @@
|
|||||||
COG_LOG(LogCategory, Verbosity, TEXT("%s - %s"), *GetNameSafe(Object), *FString::Printf(Format, ##__VA_ARGS__)); \
|
COG_LOG(LogCategory, Verbosity, TEXT("%s - %s"), *GetNameSafe(Object), *FString::Printf(Format, ##__VA_ARGS__)); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
#else //ENABLE_COG
|
||||||
|
|
||||||
|
#define IF_COG(expr) (0)
|
||||||
|
#define COG_LOG_CATEGORY FNoLoggingCategory
|
||||||
|
#define COG_LOG_ABILITY(...) (0)
|
||||||
|
|
||||||
|
#define COG_LOG_ACTIVE_FOR_OBJECT(Object) (0)
|
||||||
|
#define COG_LOG(LogCategory, Verbosity, Format, ...) (0)
|
||||||
|
#define COG_LOG_FUNC(LogCategory, Verbosity, Format, ...) (0)
|
||||||
|
#define COG_LOG_OBJECT(LogCategory, Verbosity, Actor, Format, ...) (0)
|
||||||
|
#define COG_LOG_OBJECT_NO_CONTEXT(LogCategory, Verbosity, Actor, Format, ...) (0)
|
||||||
|
|
||||||
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
#endif //!ENABLE_COG
|
|
||||||
+5
-5
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogInterfaceAllegianceActor.generated.h"
|
#include "CogCommonAllegianceActorInterface.generated.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
UENUM(BlueprintType)
|
UENUM(BlueprintType)
|
||||||
enum class ECogInterfacesAllegiance : uint8
|
enum class ECogCommonAllegiance : uint8
|
||||||
{
|
{
|
||||||
Friendly,
|
Friendly,
|
||||||
Enemy,
|
Enemy,
|
||||||
@@ -14,17 +14,17 @@ enum class ECogInterfacesAllegiance : uint8
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
UINTERFACE(MinimalAPI, Blueprintable)
|
UINTERFACE(MinimalAPI, Blueprintable)
|
||||||
class UCogInterfacesAllegianceActor : public UInterface
|
class UCogCommonAllegianceActorInterface : public UInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
class ICogInterfacesAllegianceActor
|
class ICogCommonAllegianceActorInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ECogInterfacesAllegiance GetAllegianceWithOtherActor(const AActor* OtherActor) const = 0;
|
virtual ECogCommonAllegiance GetAllegianceWithOtherActor(const AActor* OtherActor) const = 0;
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "CogCommonDebugFilteredActorInterface.generated.h"
|
||||||
|
|
||||||
|
UINTERFACE(MinimalAPI, Blueprintable)
|
||||||
|
class UCogCommonDebugFilteredActorInterface : public UInterface
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
};
|
||||||
|
|
||||||
|
class ICogCommonDebugFilteredActorInterface
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
|
class COGCOMMON_API FCogCommonModule : public IModuleInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
static inline FCogCommonModule& Get() { return FModuleManager::LoadModuleChecked<FCogCommonModule>("CogCommon"); }
|
||||||
|
|
||||||
|
virtual void StartupModule() override;
|
||||||
|
|
||||||
|
virtual void ShutdownModule() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
+3
-3
@@ -1,17 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogInterfacePossessor.generated.h"
|
#include "CogCommonPossessorInterface.generated.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
UINTERFACE(MinimalAPI, Blueprintable)
|
UINTERFACE(MinimalAPI, Blueprintable)
|
||||||
class UCogInterfacePossessor : public UInterface
|
class UCogCommonPossessorInterface : public UInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
class ICogInterfacePossessor
|
class ICogCommonPossessorInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"Enabled": true
|
"Enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "CogInterface",
|
"Name": "CogCommon",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class CogDebug : ModuleRules
|
|||||||
{
|
{
|
||||||
"Core",
|
"Core",
|
||||||
"CogImgui",
|
"CogImgui",
|
||||||
"CogInterface",
|
"CogCommon",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
#include "CogDebugDraw.h"
|
#include "CogDebugDraw.h"
|
||||||
|
|
||||||
#include "CogDebugDrawHelper.h"
|
#include "CogDebugDrawHelper.h"
|
||||||
#include "CogDebugShape.h"
|
|
||||||
#include "CogDebugHelper.h"
|
|
||||||
#include "CogDebugDrawImGui.h"
|
#include "CogDebugDrawImGui.h"
|
||||||
#include "CogImguiHelper.h"
|
#include "CogDebugHelper.h"
|
||||||
#include "CogDebugLog.h"
|
#include "CogDebugLog.h"
|
||||||
#include "CogDebugModule.h"
|
#include "CogDebugModule.h"
|
||||||
#include "CogDebugReplicator.h"
|
#include "CogDebugReplicator.h"
|
||||||
|
#include "CogDebugSettings.h"
|
||||||
|
#include "CogDebugShape.h"
|
||||||
|
#include "CogImguiHelper.h"
|
||||||
#include "Engine/SkeletalMesh.h"
|
#include "Engine/SkeletalMesh.h"
|
||||||
#include "VisualLogger/VisualLogger.h"
|
#include "VisualLogger/VisualLogger.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "CogDebugLogBlueprint.h"
|
#include "CogDebugLogBlueprint.h"
|
||||||
|
|
||||||
|
#include "CogCommon.h"
|
||||||
#include "CogDebugLog.h"
|
#include "CogDebugLog.h"
|
||||||
#include "CogDebugLogMacros.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const FString& Text)
|
void UCogDebugLogBlueprint::Log(const UObject* WorldContextObject, FCogLogCategory LogCategory, ECogLogVerbosity Verbosity, const FString& Text)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "CogDebugPlotBlueprint.h"
|
#include "CogDebugPlotBlueprint.h"
|
||||||
|
|
||||||
#include "CogDebugDefines.h"
|
#include "CogCommon.h"
|
||||||
#include "CogDebugPlot.h"
|
#include "CogDebugPlot.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "CogDebugSettings.h"
|
#include "CogDebugSettings.h"
|
||||||
|
|
||||||
#include "CogInterfaceDebugFilteredActor.h"
|
#include "CogCommonDebugFilteredActorInterface.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TWeakObjectPtr<AActor> FCogDebugSettings::Selection;
|
TWeakObjectPtr<AActor> FCogDebugSettings::Selection;
|
||||||
@@ -92,7 +92,7 @@ bool FCogDebugSettings::IsDebugActiveForObject(const UObject* WorldContextObject
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cast<ICogInterfacesDebugFilteredActor>(Outer))
|
if (Cast<ICogCommonDebugFilteredActorInterface>(Outer))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
|
|
||||||
#ifndef ENABLE_COG
|
|
||||||
#define ENABLE_COG (ENABLE_DRAW_DEBUG && !NO_LOGGING)
|
|
||||||
#endif
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogDebugLogMacros.h"
|
#include "CogCommon.h"
|
||||||
|
|
||||||
class USkeletalMeshComponent;
|
class USkeletalMeshComponent;
|
||||||
struct FCogDebugShape;
|
struct FCogDebugShape;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogDebugDefines.h"
|
|
||||||
|
|
||||||
namespace EDrawDebugTrace { enum Type; }
|
namespace EDrawDebugTrace { enum Type; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogDebugDefines.h"
|
|
||||||
#include "Logging/LogVerbosity.h"
|
#include "Logging/LogVerbosity.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogDebugDefines.h"
|
#include "CogCommon.h"
|
||||||
|
|
||||||
#ifdef ENABLE_COG
|
#ifdef ENABLE_COG
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogDebugDefines.h"
|
#include "CogCommon.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "implot.h"
|
#include "implot.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "CogDebugLogMacros.h"
|
|
||||||
|
|
||||||
struct COGDEBUG_API FCogDebugSettings
|
struct COGDEBUG_API FCogDebugSettings
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,10 @@
|
|||||||
"Name": "CogImgui",
|
"Name": "CogImgui",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Name": "CogCommon",
|
||||||
|
"Enabled": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Name": "CogDebug",
|
"Name": "CogDebug",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class CogEngine : ModuleRules
|
|||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
"Core",
|
"Core",
|
||||||
"CogInterface",
|
"CogCommon",
|
||||||
"CogImgui",
|
"CogImgui",
|
||||||
"CogDebug",
|
"CogDebug",
|
||||||
"CogWindow",
|
"CogWindow",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "CogEngineReplicator.h"
|
#include "CogEngineReplicator.h"
|
||||||
|
|
||||||
#include "CogDebugLogMacros.h"
|
#include "CogCommon.h"
|
||||||
#include "CogInterfacePossessor.h"
|
#include "CogCommonPossessorInterface.h"
|
||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
#include "GameFramework/WorldSettings.h"
|
#include "GameFramework/WorldSettings.h"
|
||||||
#include "EngineUtils.h"
|
#include "EngineUtils.h"
|
||||||
@@ -159,7 +159,7 @@ void ACogEngineReplicator::Server_Possess_Implementation(APawn* Pawn)
|
|||||||
{
|
{
|
||||||
#if !UE_BUILD_SHIPPING
|
#if !UE_BUILD_SHIPPING
|
||||||
|
|
||||||
if (ICogInterfacePossessor* Possessor = Cast<ICogInterfacePossessor>(OwnerPlayerController))
|
if (ICogCommonPossessorInterface* Possessor = Cast<ICogCommonPossessorInterface>(OwnerPlayerController))
|
||||||
{
|
{
|
||||||
Possessor->SetPossession(Pawn);
|
Possessor->SetPossession(Pawn);
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ void ACogEngineReplicator::Server_ResetPossession_Implementation()
|
|||||||
{
|
{
|
||||||
#if !UE_BUILD_SHIPPING
|
#if !UE_BUILD_SHIPPING
|
||||||
|
|
||||||
if (ICogInterfacePossessor* Possessor = Cast<ICogInterfacePossessor>(OwnerPlayerController))
|
if (ICogCommonPossessorInterface* Possessor = Cast<ICogCommonPossessorInterface>(OwnerPlayerController))
|
||||||
{
|
{
|
||||||
Possessor->ResetPossession();
|
Possessor->ResetPossession();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "CogInterfaceDebugFilteredActor.generated.h"
|
|
||||||
|
|
||||||
UINTERFACE(MinimalAPI, Blueprintable)
|
|
||||||
class UCogInterfacesDebugFilteredActor : public UInterface
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
};
|
|
||||||
|
|
||||||
class ICogInterfacesDebugFilteredActor
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
};
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "Modules/ModuleManager.h"
|
|
||||||
|
|
||||||
class COGINTERFACE_API FCogInterfaceModule : public IModuleInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
static inline FCogInterfaceModule& Get() { return FModuleManager::LoadModuleChecked<FCogInterfaceModule>("CogInterface"); }
|
|
||||||
|
|
||||||
virtual void StartupModule() override;
|
|
||||||
|
|
||||||
virtual void ShutdownModule() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
#include "CogWindowManager.h"
|
#include "CogWindowManager.h"
|
||||||
|
|
||||||
|
#include "CogDebugDrawImGui.h"
|
||||||
#include "CogImguiModule.h"
|
#include "CogImguiModule.h"
|
||||||
#include "CogImguiWidget.h"
|
#include "CogImguiWidget.h"
|
||||||
#include "CogWindowWidgets.h"
|
|
||||||
#include "CogWindow_Spacing.h"
|
#include "CogWindow_Spacing.h"
|
||||||
|
#include "CogWindowWidgets.h"
|
||||||
#include "Engine/Engine.h"
|
#include "Engine/Engine.h"
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
|
|
||||||
@@ -13,10 +14,9 @@ UCogWindowManager::UCogWindowManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void UCogWindowManager::Initialize(UWorld* InWorld, TSharedPtr<SCogImguiWidget> InImGuiWidget)
|
void UCogWindowManager::InitializeInternal()
|
||||||
{
|
{
|
||||||
World = InWorld;
|
ImGuiWidget = FCogImguiModule::Get().CreateImGuiViewport(GEngine->GameViewport, [this](float DeltaTime) { Render(DeltaTime); });
|
||||||
ImGuiWidget = InImGuiWidget;
|
|
||||||
|
|
||||||
ImGuiSettingsHandler IniHandler;
|
ImGuiSettingsHandler IniHandler;
|
||||||
IniHandler.TypeName = "Cog";
|
IniHandler.TypeName = "Cog";
|
||||||
@@ -50,6 +50,16 @@ void UCogWindowManager::Shutdown()
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void UCogWindowManager::Tick(float DeltaTime)
|
void UCogWindowManager::Tick(float DeltaTime)
|
||||||
{
|
{
|
||||||
|
if (GEngine->GameViewport == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGuiWidget.IsValid() == false)
|
||||||
|
{
|
||||||
|
InitializeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
if (LayoutToLoad != -1)
|
if (LayoutToLoad != -1)
|
||||||
{
|
{
|
||||||
FString Filename = FCogImguiHelper::GetIniFilePath(FString::Printf(TEXT("ImGui_Layout_%d"), LayoutToLoad));
|
FString Filename = FCogImguiHelper::GetIniFilePath(FString::Printf(TEXT("ImGui_Layout_%d"), LayoutToLoad));
|
||||||
@@ -112,6 +122,8 @@ void UCogWindowManager::Render(float DeltaTime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TickDPI();
|
TickDPI();
|
||||||
|
|
||||||
|
FCogDebugDrawImGui::Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ class COGWINDOW_API UCogWindowManager : public UObject
|
|||||||
public:
|
public:
|
||||||
UCogWindowManager();
|
UCogWindowManager();
|
||||||
|
|
||||||
void Initialize(UWorld* World, TSharedPtr<SCogImguiWidget> InImGuiWidget);
|
|
||||||
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
void SortMainMenu();
|
void SortMainMenu();
|
||||||
@@ -61,7 +59,7 @@ public:
|
|||||||
|
|
||||||
bool GetShowHelp() const { return bShowHelp; }
|
bool GetShowHelp() const { return bShowHelp; }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
struct FMenu
|
struct FMenu
|
||||||
{
|
{
|
||||||
@@ -70,6 +68,8 @@ private:
|
|||||||
TArray<FMenu> SubMenus;
|
TArray<FMenu> SubMenus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void InitializeInternal();
|
||||||
|
|
||||||
void RefreshDPIScale();
|
void RefreshDPIScale();
|
||||||
|
|
||||||
void DrawMainMenu();
|
void DrawMainMenu();
|
||||||
@@ -79,9 +79,13 @@ private:
|
|||||||
void DrawMenu(FMenu& Menu);
|
void DrawMenu(FMenu& Menu);
|
||||||
|
|
||||||
static void SettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*);
|
static void SettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*);
|
||||||
|
|
||||||
static void SettingsHandler_ApplyAll(ImGuiContext* ctx, ImGuiSettingsHandler*);
|
static void SettingsHandler_ApplyAll(ImGuiContext* ctx, ImGuiSettingsHandler*);
|
||||||
|
|
||||||
static void* SettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name);
|
static void* SettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name);
|
||||||
|
|
||||||
static void SettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line);
|
static void SettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line);
|
||||||
|
|
||||||
static void SettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf);
|
static void SettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf);
|
||||||
|
|
||||||
void TickDPI();
|
void TickDPI();
|
||||||
@@ -109,10 +113,13 @@ private:
|
|||||||
|
|
||||||
TSharedPtr<SCogImguiWidget> ImGuiWidget;
|
TSharedPtr<SCogImguiWidget> ImGuiWidget;
|
||||||
|
|
||||||
TWeakObjectPtr<UWorld> World;
|
|
||||||
FMenu MainMenu;
|
FMenu MainMenu;
|
||||||
|
|
||||||
int32 LayoutToLoad = -1;
|
int32 LayoutToLoad = -1;
|
||||||
|
|
||||||
int32 HideAllWindowsCounter = 0;
|
int32 HideAllWindowsCounter = 0;
|
||||||
|
|
||||||
bool bHideAllWindows = false;
|
bool bHideAllWindows = false;
|
||||||
|
|
||||||
bool bRefreshDPIScale;
|
bool bRefreshDPIScale;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ public class CogSample : ModuleRules
|
|||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[]
|
PublicDependencyModuleNames.AddRange(new string[]
|
||||||
{
|
{
|
||||||
"CogDebug",
|
"CogCommon",
|
||||||
"Core",
|
"Core",
|
||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"Engine",
|
"Engine",
|
||||||
"EnhancedInput",
|
"EnhancedInput",
|
||||||
@@ -25,8 +25,8 @@ public class CogSample : ModuleRules
|
|||||||
{
|
{
|
||||||
PublicDependencyModuleNames.AddRange(new string[]
|
PublicDependencyModuleNames.AddRange(new string[]
|
||||||
{
|
{
|
||||||
|
"CogDebug",
|
||||||
"CogImgui",
|
"CogImgui",
|
||||||
"CogInterface",
|
|
||||||
"CogWindow",
|
"CogWindow",
|
||||||
"CogEngine",
|
"CogEngine",
|
||||||
"CogInput",
|
"CogInput",
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#include "CogSampleCharacter.h"
|
#include "CogSampleCharacter.h"
|
||||||
|
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "CogDebugLogMacros.h"
|
#include "CogCommon.h"
|
||||||
#include "CogDebugMetric.h"
|
|
||||||
#include "CogSampleAttributeSet_Health.h"
|
#include "CogSampleAttributeSet_Health.h"
|
||||||
#include "CogSampleAttributeSet_Misc.h"
|
#include "CogSampleAttributeSet_Misc.h"
|
||||||
#include "CogSampleCharacterMovementComponent.h"
|
#include "CogSampleCharacterMovementComponent.h"
|
||||||
@@ -24,10 +23,11 @@
|
|||||||
#include "Net/Core/PushModel/PushModel.h"
|
#include "Net/Core/PushModel/PushModel.h"
|
||||||
#include "Net/UnrealNetwork.h"
|
#include "Net/UnrealNetwork.h"
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
#include "CogDebugDraw.h"
|
#include "CogDebugDraw.h"
|
||||||
|
#include "CogDebugMetric.h"
|
||||||
#include "CogDebugPlot.h"
|
#include "CogDebugPlot.h"
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
ACogSampleCharacter::ACogSampleCharacter(const FObjectInitializer& ObjectInitializer)
|
ACogSampleCharacter::ACogSampleCharacter(const FObjectInitializer& ObjectInitializer)
|
||||||
@@ -476,18 +476,18 @@ void ACogSampleCharacter::Look(const FInputActionValue& Value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
ECogInterfacesAllegiance ACogSampleCharacter::GetAllegianceWithOtherActor(const AActor* OtherActor) const
|
ECogCommonAllegiance ACogSampleCharacter::GetAllegianceWithOtherActor(const AActor* OtherActor) const
|
||||||
{
|
{
|
||||||
ECogSampleAllegiance Allegiance = UCogSampleFunctionLibrary_Team::GetActorsAllegiance(this, OtherActor);
|
ECogSampleAllegiance Allegiance = UCogSampleFunctionLibrary_Team::GetActorsAllegiance(this, OtherActor);
|
||||||
|
|
||||||
switch (Allegiance)
|
switch (Allegiance)
|
||||||
{
|
{
|
||||||
case ECogSampleAllegiance::Enemy: return ECogInterfacesAllegiance::Enemy;
|
case ECogSampleAllegiance::Enemy: return ECogCommonAllegiance::Enemy;
|
||||||
case ECogSampleAllegiance::Friendly: return ECogInterfacesAllegiance::Friendly;
|
case ECogSampleAllegiance::Friendly: return ECogCommonAllegiance::Friendly;
|
||||||
case ECogSampleAllegiance::Neutral: return ECogInterfacesAllegiance::Neutral;
|
case ECogSampleAllegiance::Neutral: return ECogCommonAllegiance::Neutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ECogInterfacesAllegiance::Neutral;
|
return ECogCommonAllegiance::Neutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -495,9 +495,9 @@ void ACogSampleCharacter::HandleDamageReceived(const FCogSampleDamageEventParams
|
|||||||
{
|
{
|
||||||
OnDamageReceived.Broadcast(Params);
|
OnDamageReceived.Broadcast(Params);
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
FCogDebugMetric::AddMetric(this, "Damage Received", Params.MitigatedDamage, Params.UnmitigatedDamage, false);
|
FCogDebugMetric::AddMetric(this, "Damage Received", Params.MitigatedDamage, Params.UnmitigatedDamage, false);
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -505,9 +505,9 @@ void ACogSampleCharacter::HandleDamageDealt(const FCogSampleDamageEventParams& P
|
|||||||
{
|
{
|
||||||
OnDamageDealt.Broadcast(Params);
|
OnDamageDealt.Broadcast(Params);
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
FCogDebugMetric::AddMetric(this, "Damage Dealt", Params.MitigatedDamage, Params.UnmitigatedDamage, false);
|
FCogDebugMetric::AddMetric(this, "Damage Dealt", Params.MitigatedDamage, Params.UnmitigatedDamage, false);
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -553,21 +553,21 @@ void ACogSampleCharacter::OnRevived(AActor* InInstigator, AActor* InCauser, cons
|
|||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
void ACogSampleCharacter::OnGameplayEffectAdded(UAbilitySystemComponent* AbilitySystemComponent, const FGameplayEffectSpec& GameplayEffectSpec, FActiveGameplayEffectHandle Handle)
|
void ACogSampleCharacter::OnGameplayEffectAdded(UAbilitySystemComponent* AbilitySystemComponent, const FGameplayEffectSpec& GameplayEffectSpec, FActiveGameplayEffectHandle Handle)
|
||||||
{
|
{
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
FCogDebugPlot::PlotEvent(this, "Effects", GameplayEffectSpec.Def->GetFName(), GameplayEffectSpec.GetDuration() == 0.0f)
|
FCogDebugPlot::PlotEvent(this, "Effects", GameplayEffectSpec.Def->GetFName(), GameplayEffectSpec.GetDuration() == 0.0f)
|
||||||
.AddParam("Name", AbilitySystemComponent->CleanupName(GetNameSafe(GameplayEffectSpec.Def)))
|
.AddParam("Name", AbilitySystemComponent->CleanupName(GetNameSafe(GameplayEffectSpec.Def)))
|
||||||
.AddParam("Effect Instigator", GetNameSafe(GameplayEffectSpec.GetEffectContext().GetInstigator()))
|
.AddParam("Effect Instigator", GetNameSafe(GameplayEffectSpec.GetEffectContext().GetInstigator()))
|
||||||
.AddParam("Effect Level", GameplayEffectSpec.GetLevel())
|
.AddParam("Effect Level", GameplayEffectSpec.GetLevel())
|
||||||
.AddParam("Effect Duration", GameplayEffectSpec.GetDuration());
|
.AddParam("Effect Duration", GameplayEffectSpec.GetDuration());
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
void ACogSampleCharacter::OnGameplayEffectRemoved(const FActiveGameplayEffect& RemovedGameplayEffect)
|
void ACogSampleCharacter::OnGameplayEffectRemoved(const FActiveGameplayEffect& RemovedGameplayEffect)
|
||||||
{
|
{
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
FCogDebugPlot::PlotEventStop(this, "Effects", RemovedGameplayEffect.Spec.Def->GetFName());
|
FCogDebugPlot::PlotEventStop(this, "Effects", RemovedGameplayEffect.Spec.Def->GetFName());
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#include "AbilitySystemInterface.h"
|
#include "AbilitySystemInterface.h"
|
||||||
#include "ActiveGameplayEffectHandle.h"
|
#include "ActiveGameplayEffectHandle.h"
|
||||||
#include "AttributeSet.h"
|
#include "AttributeSet.h"
|
||||||
#include "CogSampleDefines.h"
|
#include "CogCommonAllegianceActorInterface.h"
|
||||||
#include "CogInterfaceAllegianceActor.h"
|
#include "CogCommonDebugFilteredActorInterface.h"
|
||||||
#include "CogInterfaceDebugFilteredActor.h"
|
|
||||||
#include "CogSampleDamageEvent.h"
|
#include "CogSampleDamageEvent.h"
|
||||||
|
#include "CogSampleDefines.h"
|
||||||
#include "CogSampleTargetableInterface.h"
|
#include "CogSampleTargetableInterface.h"
|
||||||
#include "CogSampleTeamInterface.h"
|
#include "CogSampleTeamInterface.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
@@ -65,8 +65,8 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCogSampleCharacterEventDelegate, AC
|
|||||||
UCLASS(config=Game)
|
UCLASS(config=Game)
|
||||||
class ACogSampleCharacter : public ACharacter
|
class ACogSampleCharacter : public ACharacter
|
||||||
, public IAbilitySystemInterface
|
, public IAbilitySystemInterface
|
||||||
, public ICogInterfacesDebugFilteredActor
|
, public ICogCommonDebugFilteredActorInterface
|
||||||
, public ICogInterfacesAllegianceActor
|
, public ICogCommonAllegianceActorInterface
|
||||||
, public ICogSampleTeamInterface
|
, public ICogSampleTeamInterface
|
||||||
, public ICogSampleTargetableInterface
|
, public ICogSampleTargetableInterface
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
// ICogInterfacesAllegianceActor overrides
|
// ICogInterfacesAllegianceActor overrides
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ECogInterfacesAllegiance GetAllegianceWithOtherActor(const AActor* OtherActor) const override;
|
ECogCommonAllegiance GetAllegianceWithOtherActor(const AActor* OtherActor) const override;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
// ICogSampleTargetInterface overrides
|
// ICogSampleTargetInterface overrides
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
#include "CogDebugDraw.h"
|
#include "CogDebugDraw.h"
|
||||||
#include "CogDebugPlot.h"
|
#include "CogDebugPlot.h"
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
// UCogSampleCharacterMovementComponent::FCogSampleSavedMove
|
// UCogSampleCharacterMovementComponent::FCogSampleSavedMove
|
||||||
@@ -209,17 +209,17 @@ void UCogSampleCharacterMovementComponent::BeginPlay()
|
|||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
const ACharacter* Character = GetCharacterOwner();
|
const ACharacter* Character = GetCharacterOwner();
|
||||||
const UCapsuleComponent* CapsuleComponent = Character->GetCapsuleComponent();
|
const UCapsuleComponent* CapsuleComponent = Character->GetCapsuleComponent();
|
||||||
DebugLastBottomLocation = Character->GetActorLocation() - FVector::UpVector * CapsuleComponent->GetScaledCapsuleHalfHeight();
|
DebugLastBottomLocation = Character->GetActorLocation() - FVector::UpVector * CapsuleComponent->GetScaledCapsuleHalfHeight();
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void UCogSampleCharacterMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
void UCogSampleCharacterMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||||
{
|
{
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
|
|
||||||
const ACharacter* Character = GetCharacterOwner();
|
const ACharacter* Character = GetCharacterOwner();
|
||||||
const UCapsuleComponent* CapsuleComponent = Character->GetCapsuleComponent();
|
const UCapsuleComponent* CapsuleComponent = Character->GetCapsuleComponent();
|
||||||
@@ -232,11 +232,11 @@ void UCogSampleCharacterMovementComponent::TickComponent(float DeltaTime, enum E
|
|||||||
FCogDebugPlot::PlotValue(GetPawnOwner(), "Move Input Local Y", FVector::DotProduct(GetPawnOwner()->GetActorForwardVector(), GetPendingInputVector()));
|
FCogDebugPlot::PlotValue(GetPawnOwner(), "Move Input Local Y", FVector::DotProduct(GetPawnOwner()->GetActorForwardVector(), GetPendingInputVector()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
|
|
||||||
const FVector DebugLocation = Character->GetActorLocation();
|
const FVector DebugLocation = Character->GetActorLocation();
|
||||||
const FVector DebugBottomLocation = DebugLocation - FVector::UpVector * CapsuleComponent->GetScaledCapsuleHalfHeight();
|
const FVector DebugBottomLocation = DebugLocation - FVector::UpVector * CapsuleComponent->GetScaledCapsuleHalfHeight();
|
||||||
@@ -294,7 +294,7 @@ void UCogSampleCharacterMovementComponent::TickComponent(float DeltaTime, enum E
|
|||||||
DebugLastVelocity = Velocity;
|
DebugLastVelocity = Velocity;
|
||||||
DebugIsPositionCorrected = false;
|
DebugIsPositionCorrected = false;
|
||||||
|
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,9 +303,9 @@ bool UCogSampleCharacterMovementComponent::ClientUpdatePositionAfterServerUpdate
|
|||||||
{
|
{
|
||||||
bool Result = Super::ClientUpdatePositionAfterServerUpdate();
|
bool Result = Super::ClientUpdatePositionAfterServerUpdate();
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
DebugIsPositionCorrected = true;
|
DebugIsPositionCorrected = true;
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ private:
|
|||||||
|
|
||||||
bool bWasAvoidanceEnabled = false;
|
bool bWasAvoidanceEnabled = false;
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
|
|
||||||
FVector DebugLastBottomLocation = FVector::ZeroVector;
|
FVector DebugLastBottomLocation = FVector::ZeroVector;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ private:
|
|||||||
|
|
||||||
bool DebugIsPositionCorrected = false;
|
bool DebugIsPositionCorrected = false;
|
||||||
|
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,19 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "CogCommon.h"
|
||||||
|
|
||||||
#ifndef USE_COG
|
#if ENABLE_COG
|
||||||
#define USE_COG (ENABLE_DRAW_DEBUG && !NO_LOGGING)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_COG
|
|
||||||
|
|
||||||
#include "CogDebugLogMacros.h"
|
|
||||||
#include "CogDebugSettings.h"
|
#include "CogDebugSettings.h"
|
||||||
|
|
||||||
#define IF_COG(expr) { expr; }
|
|
||||||
#define COG_LOG_CATEGORY FLogCategoryBase
|
|
||||||
|
|
||||||
#define COG_LOG_ABILITY(Verbosity, Ability, Format, ...) \
|
#define COG_LOG_ABILITY(Verbosity, Ability, Format, ...) \
|
||||||
if (Ability != nullptr) \
|
if (Ability != nullptr) \
|
||||||
{ \
|
{ \
|
||||||
@@ -28,10 +21,8 @@
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
#else //USE_COG
|
#else //ENABLE_COG
|
||||||
|
|
||||||
#define IF_COG(expr) (0)
|
|
||||||
#define COG_LOG_CATEGORY FNoLoggingCategory
|
|
||||||
#define COG_LOG_ABILITY(...) (0)
|
#define COG_LOG_ABILITY(...) (0)
|
||||||
|
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
#include "Particles/ParticleSystemComponent.h"
|
#include "Particles/ParticleSystemComponent.h"
|
||||||
#include "ScalableFloat.h"
|
#include "ScalableFloat.h"
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
#include "CogDebugDraw.h"
|
#include "CogDebugDraw.h"
|
||||||
#include "CogDebugLog.h"
|
#include "CogDebugLog.h"
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void UCogSampleFunctionLibrary_Gameplay::AdjustAttributeForMaxChange(UAbilitySystemComponent* AbilityComponent, FGameplayAttributeData& AffectedAttribute, float OldValue, float NewMaxValue, const FGameplayAttribute& AffectedAttributeProperty)
|
void UCogSampleFunctionLibrary_Gameplay::AdjustAttributeForMaxChange(UAbilitySystemComponent* AbilityComponent, FGameplayAttributeData& AffectedAttribute, float OldValue, float NewMaxValue, const FGameplayAttribute& AffectedAttributeProperty)
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
#include "AssetRegistry/AssetRegistryModule.h"
|
#include "AssetRegistry/AssetRegistryModule.h"
|
||||||
#include "AssetRegistry/IAssetRegistry.h"
|
#include "AssetRegistry/IAssetRegistry.h"
|
||||||
#include "CogSampleDefines.h"
|
#include "CogCommon.h"
|
||||||
#include "CogSampleFunctionLibrary_Tag.h"
|
#include "CogSampleFunctionLibrary_Tag.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "GameFramework/GameMode.h"
|
#include "GameFramework/GameMode.h"
|
||||||
#include "GameFramework/GameState.h"
|
#include "GameFramework/GameState.h"
|
||||||
#include "Modules/ModuleManager.h"
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
#include "CogAbilityDataAsset_Abilities.h"
|
#include "CogAbilityDataAsset_Abilities.h"
|
||||||
#include "CogAbilityDataAsset_Cheats.h"
|
#include "CogAbilityDataAsset_Cheats.h"
|
||||||
#include "CogAbilityDataAsset_Pools.h"
|
#include "CogAbilityDataAsset_Pools.h"
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
#include "CogAbilityWindow_Pools.h"
|
#include "CogAbilityWindow_Pools.h"
|
||||||
#include "CogAbilityWindow_Tags.h"
|
#include "CogAbilityWindow_Tags.h"
|
||||||
#include "CogAbilityWindow_Tweaks.h"
|
#include "CogAbilityWindow_Tweaks.h"
|
||||||
#include "CogDebugDefines.h"
|
|
||||||
#include "CogDebugDrawImGui.h"
|
#include "CogDebugDrawImGui.h"
|
||||||
#include "CogDebugPlot.h"
|
#include "CogDebugPlot.h"
|
||||||
#include "CogEngineDataAsset_Collisions.h"
|
#include "CogEngineDataAsset_Collisions.h"
|
||||||
@@ -47,7 +46,7 @@
|
|||||||
#include "CogInputWindow_Actions.h"
|
#include "CogInputWindow_Actions.h"
|
||||||
#include "CogInputWindow_Gamepad.h"
|
#include "CogInputWindow_Gamepad.h"
|
||||||
#include "CogWindowManager.h"
|
#include "CogWindowManager.h"
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -82,6 +81,10 @@ ACogSampleGameState::ACogSampleGameState(const FObjectInitializer & ObjectInitia
|
|||||||
void ACogSampleGameState::BeginPlay()
|
void ACogSampleGameState::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
#if ENABLE_COG
|
||||||
|
InitializeCog();
|
||||||
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -89,12 +92,12 @@ void ACogSampleGameState::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
|||||||
{
|
{
|
||||||
Super::EndPlay(EndPlayReason);
|
Super::EndPlay(EndPlayReason);
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
if (CogWindowManager != nullptr)
|
if (CogWindowManager != nullptr)
|
||||||
{
|
{
|
||||||
CogWindowManager->Shutdown();
|
CogWindowManager->Shutdown();
|
||||||
}
|
}
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -102,48 +105,28 @@ void ACogSampleGameState::Tick(float DeltaSeconds)
|
|||||||
{
|
{
|
||||||
Super::Tick(DeltaSeconds);
|
Super::Tick(DeltaSeconds);
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
TickCog(DeltaSeconds);
|
|
||||||
#endif //USE_COG
|
|
||||||
}
|
|
||||||
|
|
||||||
#if USE_COG
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void ACogSampleGameState::TickCog(float DeltaSeconds)
|
|
||||||
{
|
|
||||||
//---------------------------------------
|
|
||||||
// Wait for the viewport to be set
|
|
||||||
//---------------------------------------
|
|
||||||
if (GEngine->GameViewport != nullptr)
|
|
||||||
{
|
|
||||||
if (CogWindowManager == nullptr)
|
|
||||||
{
|
|
||||||
InitializeCog();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CogWindowManager->Tick(DeltaSeconds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern ENGINE_API float GAverageFPS;
|
extern ENGINE_API float GAverageFPS;
|
||||||
extern ENGINE_API float GAverageMS;
|
extern ENGINE_API float GAverageMS;
|
||||||
FCogDebugPlot::PlotValue(this, "Frame Rate", GAverageFPS);
|
FCogDebugPlot::PlotValue(this, "Frame Rate", GAverageFPS);
|
||||||
FCogDebugPlot::PlotValue(this, "Frame Time", GAverageMS);
|
FCogDebugPlot::PlotValue(this, "Frame Time", GAverageMS);
|
||||||
|
|
||||||
|
CogWindowManager->Tick(DeltaSeconds);
|
||||||
|
|
||||||
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_COG
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void ACogSampleGameState::InitializeCog()
|
void ACogSampleGameState::InitializeCog()
|
||||||
{
|
{
|
||||||
RegisterCommand(TEXT("Cog.ToggleInput"), TEXT(""), FConsoleCommandWithArgsDelegate::CreateUObject(this, &ACogSampleGameState::CogToggleInput));
|
|
||||||
|
|
||||||
TSharedPtr<SCogImguiWidget> Widget = FCogImguiModule::Get().CreateImGuiViewport(GEngine->GameViewport, [this](float DeltaTime) { RenderCog(DeltaTime); });
|
|
||||||
FCogImguiModule::Get().SetToggleInputKey(FCogImGuiKeyInfo(EKeys::Insert));
|
FCogImguiModule::Get().SetToggleInputKey(FCogImGuiKeyInfo(EKeys::Insert));
|
||||||
|
RegisterCommand(TEXT("Cog.ToggleInput"), TEXT(""), FConsoleCommandWithArgsDelegate::CreateUObject(this, &ACogSampleGameState::CogToggleInput));
|
||||||
|
|
||||||
CogWindowManager = NewObject<UCogWindowManager>(this);
|
CogWindowManager = NewObject<UCogWindowManager>(this);
|
||||||
CogWindowManagerRef = CogWindowManager;
|
CogWindowManagerRef = CogWindowManager;
|
||||||
CogWindowManager->Initialize(GetWorld(), Widget);
|
|
||||||
|
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
// Engine
|
// Engine
|
||||||
@@ -174,7 +157,7 @@ void ACogSampleGameState::InitializeCog()
|
|||||||
|
|
||||||
CogWindowManager->CreateWindow<UCogEngineWindow_Skeleton>("Engine.Skeleton");
|
CogWindowManager->CreateWindow<UCogEngineWindow_Skeleton>("Engine.Skeleton");
|
||||||
|
|
||||||
UCogEngineWindow_Spawns* SpawnWindow =CogWindowManager->CreateWindow<UCogEngineWindow_Spawns>("Engine.Spawns");
|
UCogEngineWindow_Spawns* SpawnWindow = CogWindowManager->CreateWindow<UCogEngineWindow_Spawns>("Engine.Spawns");
|
||||||
SpawnWindow->SetSpawnsAsset(GetFirstAssetByClass<UCogEngineDataAsset_Spawns>());
|
SpawnWindow->SetSpawnsAsset(GetFirstAssetByClass<UCogEngineDataAsset_Spawns>());
|
||||||
|
|
||||||
UCogEngineWindow_Stats* StatsWindow = CogWindowManager->CreateWindow<UCogEngineWindow_Stats>("Engine.Stats");
|
UCogEngineWindow_Stats* StatsWindow = CogWindowManager->CreateWindow<UCogEngineWindow_Stats>("Engine.Stats");
|
||||||
@@ -220,13 +203,6 @@ void ACogSampleGameState::InitializeCog()
|
|||||||
CogWindowManager->AddMainMenuWidget(StatsWindow);
|
CogWindowManager->AddMainMenuWidget(StatsWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
|
||||||
void ACogSampleGameState::RenderCog(float DeltaTime)
|
|
||||||
{
|
|
||||||
CogWindowManager->Render(DeltaTime);
|
|
||||||
FCogDebugDrawImGui::Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void ACogSampleGameState::RegisterCommand(const TCHAR* Name, const TCHAR* Help, const FConsoleCommandWithArgsDelegate& Command)
|
void ACogSampleGameState::RegisterCommand(const TCHAR* Name, const TCHAR* Help, const FConsoleCommandWithArgsDelegate& Command)
|
||||||
{
|
{
|
||||||
@@ -244,4 +220,4 @@ void ACogSampleGameState::CogToggleInput(const TArray<FString>& Args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|||||||
@@ -25,19 +25,15 @@ private:
|
|||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TObjectPtr<UObject> CogWindowManagerRef = nullptr;
|
TObjectPtr<UObject> CogWindowManagerRef = nullptr;
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
|
|
||||||
void InitializeCog();
|
void InitializeCog();
|
||||||
|
|
||||||
void TickCog(float DeltaTime);
|
|
||||||
|
|
||||||
void RenderCog(float DeltaTime);
|
|
||||||
|
|
||||||
void RegisterCommand(const TCHAR* Name, const TCHAR* Help, const FConsoleCommandWithArgsDelegate& Command);
|
void RegisterCommand(const TCHAR* Name, const TCHAR* Help, const FConsoleCommandWithArgsDelegate& Command);
|
||||||
|
|
||||||
void CogToggleInput(const TArray<FString>& Args);
|
void CogToggleInput(const TArray<FString>& Args);
|
||||||
|
|
||||||
TObjectPtr<UCogWindowManager> CogWindowManager = nullptr;
|
TObjectPtr<UCogWindowManager> CogWindowManager = nullptr;
|
||||||
|
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
#include "AbilitySystemLog.h"
|
#include "AbilitySystemLog.h"
|
||||||
#include "CogSampleDefines.h"
|
#include "CogSampleDefines.h"
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
#include "CogDebugLog.h"
|
#include "CogDebugLog.h"
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
DEFINE_LOG_CATEGORY(LogCogAlways);
|
DEFINE_LOG_CATEGORY(LogCogAlways);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ namespace CogSampleLog
|
|||||||
{
|
{
|
||||||
void RegiterAllLogCategories()
|
void RegiterAllLogCategories()
|
||||||
{
|
{
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
FCogDebugLog::AddLogCategory(LogCogAlways, "Always", false);
|
FCogDebugLog::AddLogCategory(LogCogAlways, "Always", false);
|
||||||
|
|
||||||
FCogDebugLog::AddLogCategory(LogCogAbility, "Ability");
|
FCogDebugLog::AddLogCategory(LogCogAbility, "Ability");
|
||||||
@@ -39,7 +39,7 @@ namespace CogSampleLog
|
|||||||
FCogDebugLog::AddLogCategory(LogCogSkeleton, "Skeleton");
|
FCogDebugLog::AddLogCategory(LogCogSkeleton, "Skeleton");
|
||||||
FCogDebugLog::AddLogCategory(LogCogTargetAcquisition, "Target Acquisition");
|
FCogDebugLog::AddLogCategory(LogCogTargetAcquisition, "Target Acquisition");
|
||||||
FCogDebugLog::AddLogCategory(LogGameplayEffects, "Gameplay Effects");
|
FCogDebugLog::AddLogCategory(LogGameplayEffects, "Gameplay Effects");
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
#include "CogSamplePlayerController.h"
|
#include "CogSamplePlayerController.h"
|
||||||
|
|
||||||
#include "CogDebugLogMacros.h"
|
#include "CogCommon.h"
|
||||||
#include "CogSampleDefines.h"
|
#include "CogSampleDefines.h"
|
||||||
#include "CogSampleCharacter.h"
|
#include "CogSampleCharacter.h"
|
||||||
#include "CogSampleLogCategories.h"
|
#include "CogSampleLogCategories.h"
|
||||||
#include "CogSampleTargetAcquisition.h"
|
#include "CogSampleTargetAcquisition.h"
|
||||||
#include "Net/UnrealNetwork.h"
|
#include "Net/UnrealNetwork.h"
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
#include "CogAbilityReplicator.h"
|
#include "CogAbilityReplicator.h"
|
||||||
#include "CogDebugDefines.h"
|
|
||||||
#include "CogDebugDraw.h"
|
#include "CogDebugDraw.h"
|
||||||
#include "CogDebugReplicator.h"
|
#include "CogDebugReplicator.h"
|
||||||
#include "CogEngineReplicator.h"
|
#include "CogEngineReplicator.h"
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
ACogSamplePlayerController::ACogSamplePlayerController()
|
ACogSamplePlayerController::ACogSamplePlayerController()
|
||||||
@@ -25,11 +24,11 @@ void ACogSamplePlayerController::BeginPlay()
|
|||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
ACogDebugReplicator::Spawn(this);
|
ACogDebugReplicator::Spawn(this);
|
||||||
ACogAbilityReplicator::Spawn(this);
|
ACogAbilityReplicator::Spawn(this);
|
||||||
ACogEngineReplicator::Spawn(this);
|
ACogEngineReplicator::Spawn(this);
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -169,12 +168,12 @@ void ACogSamplePlayerController::TickTargeting(float DeltaSeconds)
|
|||||||
SetTarget(Result.Target);
|
SetTarget(Result.Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
if (Target != nullptr && PossessedCharacter != nullptr)
|
if (Target != nullptr && PossessedCharacter != nullptr)
|
||||||
{
|
{
|
||||||
FCogDebugDraw::Segment(LogCogTargetAcquisition, PossessedCharacter.Get(), PossessedCharacter->GetActorLocation(), Target->GetActorLocation(), FColor::White, false);
|
FCogDebugDraw::Segment(LogCogTargetAcquisition, PossessedCharacter.Get(), PossessedCharacter->GetActorLocation(), Target->GetActorLocation(), FColor::White, false);
|
||||||
}
|
}
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "AbilitySystemInterface.h"
|
#include "AbilitySystemInterface.h"
|
||||||
#include "CogInterfacePossessor.h"
|
#include "CogCommonPossessorInterface.h"
|
||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
#include "CogSamplePlayerController.generated.h"
|
#include "CogSamplePlayerController.generated.h"
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FCogSampleControlledCharacterChan
|
|||||||
UCLASS(config=Game)
|
UCLASS(config=Game)
|
||||||
class ACogSamplePlayerController
|
class ACogSamplePlayerController
|
||||||
: public APlayerController
|
: public APlayerController
|
||||||
, public ICogInterfacePossessor
|
, public ICogCommonPossessorInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
#include "CogDebugDraw.h"
|
#include "CogDebugDraw.h"
|
||||||
#include "CogDebugLog.h"
|
#include "CogDebugLog.h"
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
// FCogSampleTargetTargetAcquisitionParams
|
// FCogSampleTargetTargetAcquisitionParams
|
||||||
@@ -125,13 +125,13 @@ void UCogSampleTargetAcquisition::FindBestTarget(
|
|||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
// Draw the ScreenSearchDirection if valid
|
// Draw the ScreenSearchDirection if valid
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
const FVector2D SearchDirectionNormalized = (TargetSwitchSearchDirection.IsNearlyZero() == false) ? TargetSwitchSearchDirection.GetSafeNormal() : FVector2D::ZeroVector;
|
const FVector2D SearchDirectionNormalized = (TargetSwitchSearchDirection.IsNearlyZero() == false) ? TargetSwitchSearchDirection.GetSafeNormal() : FVector2D::ZeroVector;
|
||||||
if (SearchDirectionNormalized.IsNearlyZero() == false)
|
if (SearchDirectionNormalized.IsNearlyZero() == false)
|
||||||
{
|
{
|
||||||
FCogDebugDraw::Segment2D(LogCogTargetAcquisition, Controller, FVector2D::ZeroVector, FVector2D(SearchDirectionNormalized.X, -SearchDirectionNormalized.Y), FColor(255, 255, 0, 255), bIsDebugPersistent);
|
FCogDebugDraw::Segment2D(LogCogTargetAcquisition, Controller, FVector2D::ZeroVector, FVector2D(SearchDirectionNormalized.X, -SearchDirectionNormalized.Y), FColor(255, 255, 0, 255), bIsDebugPersistent);
|
||||||
}
|
}
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
static const FName TraceTag(TEXT("FindLockTarget_GatherTargets"));
|
static const FName TraceTag(TEXT("FindLockTarget_GatherTargets"));
|
||||||
FCollisionQueryParams QueryParams(TraceTag, SCENE_QUERY_STAT_ONLY(CogSampleTargetAcquisition), false);
|
FCollisionQueryParams QueryParams(TraceTag, SCENE_QUERY_STAT_ONLY(CogSampleTargetAcquisition), false);
|
||||||
@@ -285,7 +285,7 @@ void UCogSampleTargetAcquisition::FindBestTargetInCandidates(
|
|||||||
// Draw screen limits
|
// Draw screen limits
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
|
|
||||||
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, Controller, ScreenCrosshairPosition, 5.0f, FColor(255, 255, 255, 255), bIsDebugPersistent);
|
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, Controller, ScreenCrosshairPosition, 5.0f, FColor(255, 255, 255, 255), bIsDebugPersistent);
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ void UCogSampleTargetAcquisition::FindBestTargetInCandidates(
|
|||||||
bIsDebugPersistent);
|
bIsDebugPersistent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
const FRotator YawRotation = GetReferentialRotation(Character, YawReferential);
|
const FRotator YawRotation = GetReferentialRotation(Character, YawReferential);
|
||||||
const FVector YawDirection = YawRotation.Vector();
|
const FVector YawDirection = YawRotation.Vector();
|
||||||
@@ -545,7 +545,7 @@ bool UCogSampleTargetAcquisition::EvaluateCandidate(
|
|||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
// Draw the score of each candidate
|
// Draw the score of each candidate
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
|
|
||||||
if (FCogDebugLog::IsLogCategoryActive(LogCogTargetAcquisition))
|
if (FCogDebugLog::IsLogCategoryActive(LogCogTargetAcquisition))
|
||||||
{
|
{
|
||||||
@@ -597,7 +597,7 @@ bool UCogSampleTargetAcquisition::EvaluateCandidate(
|
|||||||
FCogDebugDraw::String(LogCogTargetAcquisition, EvalParams.Controller, Text, CandidateTargetLocation, FColor::White, EvalParams.IsDebugPersistent);
|
FCogDebugDraw::String(LogCogTargetAcquisition, EvalParams.Controller, Text, CandidateTargetLocation, FColor::White, EvalParams.IsDebugPersistent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -669,13 +669,13 @@ bool UCogSampleTargetAcquisition::ComputeCandidateScreenLocation(
|
|||||||
bFoundValidCandidate = true;
|
bFoundValidCandidate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
const FColor CapsuleColor = (ScreenCenterToCapsuleDistance > 0.0f) ? FColor(255, 255, 255, 100) : FColor(0, 255, 0, 200);
|
const FColor CapsuleColor = (ScreenCenterToCapsuleDistance > 0.0f) ? FColor(255, 255, 255, 100) : FColor(0, 255, 0, 200);
|
||||||
FCogDebugDraw::Segment2D(LogCogTargetAcquisition, CandidateActor, CapsuleBot2D + FVector2D(CapsuleRadius2D, 0), CapsuleTop2D + FVector2D(CapsuleRadius2D, 0), CapsuleColor, Params.IsDebugPersistent);
|
FCogDebugDraw::Segment2D(LogCogTargetAcquisition, CandidateActor, CapsuleBot2D + FVector2D(CapsuleRadius2D, 0), CapsuleTop2D + FVector2D(CapsuleRadius2D, 0), CapsuleColor, Params.IsDebugPersistent);
|
||||||
FCogDebugDraw::Segment2D(LogCogTargetAcquisition, CandidateActor, CapsuleBot2D - FVector2D(CapsuleRadius2D, 0), CapsuleTop2D - FVector2D(CapsuleRadius2D, 0), CapsuleColor, Params.IsDebugPersistent);
|
FCogDebugDraw::Segment2D(LogCogTargetAcquisition, CandidateActor, CapsuleBot2D - FVector2D(CapsuleRadius2D, 0), CapsuleTop2D - FVector2D(CapsuleRadius2D, 0), CapsuleColor, Params.IsDebugPersistent);
|
||||||
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, CandidateActor, CapsuleTop2D, CapsuleRadius2D, CapsuleColor, Params.IsDebugPersistent);
|
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, CandidateActor, CapsuleTop2D, CapsuleRadius2D, CapsuleColor, Params.IsDebugPersistent);
|
||||||
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, CandidateActor, CapsuleBot2D, CapsuleRadius2D, CapsuleColor, Params.IsDebugPersistent);
|
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, CandidateActor, CapsuleBot2D, CapsuleRadius2D, CapsuleColor, Params.IsDebugPersistent);
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -688,12 +688,12 @@ bool UCogSampleTargetAcquisition::ComputeCandidateScreenLocation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_COG
|
#if ENABLE_COG
|
||||||
if (bFoundValidCandidate)
|
if (bFoundValidCandidate)
|
||||||
{
|
{
|
||||||
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, CandidateActor, CandidateClosestScreenLocation, 2.0f, FColor(0, 255, 0, 255), Params.IsDebugPersistent);
|
FCogDebugDraw::Circle2D(LogCogTargetAcquisition, CandidateActor, CandidateClosestScreenLocation, 2.0f, FColor(0, 255, 0, 255), Params.IsDebugPersistent);
|
||||||
}
|
}
|
||||||
#endif //USE_COG
|
#endif //ENABLE_COG
|
||||||
|
|
||||||
return bFoundValidCandidate;
|
return bFoundValidCandidate;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user