diff --git a/Content/Characters/Children/Hero1/BP_Hero1.uasset b/Content/Characters/Children/Hero1/BP_Hero1.uasset index 70a31fb..1827bcd 100644 Binary files a/Content/Characters/Children/Hero1/BP_Hero1.uasset and b/Content/Characters/Children/Hero1/BP_Hero1.uasset differ diff --git a/Content/Characters/Children/Hero2/BP_Hero2.uasset b/Content/Characters/Children/Hero2/BP_Hero2.uasset index 7c16939..3ebdd58 100644 Binary files a/Content/Characters/Children/Hero2/BP_Hero2.uasset and b/Content/Characters/Children/Hero2/BP_Hero2.uasset differ diff --git a/Content/Core/Debug/DA_Debug_Spawns.uasset b/Content/Core/Debug/DA_Debug_Spawns.uasset index 447680e..c050097 100644 Binary files a/Content/Core/Debug/DA_Debug_Spawns.uasset and b/Content/Core/Debug/DA_Debug_Spawns.uasset differ diff --git a/Plugins/CogAbility/CogAbility.uplugin b/Plugins/CogAbility/CogAbility.uplugin index adce5c1..4388429 100644 --- a/Plugins/CogAbility/CogAbility.uplugin +++ b/Plugins/CogAbility/CogAbility.uplugin @@ -26,6 +26,10 @@ "Name": "CogImgui", "Enabled": true }, + { + "Name": "CogInterfaces", + "Enabled": true + }, { "Name": "CogDebug", "Enabled": true diff --git a/Plugins/CogAbility/Source/CogAbility/CogAbility.Build.cs b/Plugins/CogAbility/Source/CogAbility/CogAbility.Build.cs index 66c42db..803a161 100644 --- a/Plugins/CogAbility/Source/CogAbility/CogAbility.Build.cs +++ b/Plugins/CogAbility/Source/CogAbility/CogAbility.Build.cs @@ -23,6 +23,7 @@ public class CogAbility : ModuleRules { "Core", "CogImgui", + "CogInterfaces", "CogDebug", "CogWindow", "GameplayAbilities", diff --git a/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Cheats.cpp b/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Cheats.cpp index a923fd6..3a73938 100644 --- a/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Cheats.cpp +++ b/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Cheats.cpp @@ -1,7 +1,7 @@ #include "CogAbilityWindow_Cheats.h" #include "CogAbilityDataAsset_Cheats.h" -#include "CogDebugAllegianceInterface.h" +#include "CogInterfacesAllegiance.h" #include "CogDebugDraw.h" #include "CogImguiHelper.h" #include "EngineUtils.h" @@ -142,15 +142,15 @@ void UCogAbilityWindow_Cheats::RequestCheat(AActor* CheatInstigator, AActor* Sel { if (AActor* OtherActor = *It) { - ECogAllegiance Allegiance = ECogAllegiance::Enemy; + ECogInterfacesAllegiance Allegiance = ECogInterfacesAllegiance::Enemy; - if (ICogAllegianceInterface* AllegianceInterface = Cast(OtherActor)) + if (ICogInterfacesAllegianceActor* AllegianceInterface = Cast(OtherActor)) { AllegianceInterface->GetAllegiance(CheatInstigator); } - if ((IsShiftDown && (Allegiance == ECogAllegiance::Enemy)) - || (IsAltDown && (Allegiance == ECogAllegiance::Ally))) + if ((IsShiftDown && (Allegiance == ECogInterfacesAllegiance::Enemy)) + || (IsAltDown && (Allegiance == ECogInterfacesAllegiance::Ally))) { Actors.Add(OtherActor); } diff --git a/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Damages.cpp b/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Damages.cpp index c1c8eb0..b83bab1 100644 --- a/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Damages.cpp +++ b/Plugins/CogAbility/Source/CogAbility/Private/CogAbilityWindow_Damages.cpp @@ -1,6 +1,6 @@ #include "CogAbilityWindow_Damages.h" -#include "CogAbilityDamageActorInterface.h" +#include "CogInterfacesDamageActor.h" #include "CogImguiHelper.h" #include "imgui.h" @@ -149,6 +149,10 @@ static void DrawDamages(FCogDamageStats& Damage) ImGui::EndTable(); } + ImGui::Text("Timer"); + ImGui::SameLine(FCogWindowWidgets::TextBaseWidth * 20); + ImGui::Text("%0.2f", Damage.Timer); + ImGui::Text("Crits"); ImGui::SameLine(FCogWindowWidgets::TextBaseWidth * 20); FCogWindowWidgets::ProgressBarCentered(Damage.Count == 0 ? 0.0f : Damage.Crits / (float)Damage.Count, ImVec2(-1, 0), TCHAR_TO_ANSI(*FString::Printf(TEXT("%d / %d"), Damage.Crits, Damage.Count))); @@ -173,11 +177,6 @@ static void DrawDamages(FCogDamageStats& Damage) ImGui::Spacing(); } -//-------------------------------------------------------------------------------------------------------------------------- -UCogAbilityWindow_Damages::UCogAbilityWindow_Damages() -{ -} - //-------------------------------------------------------------------------------------------------------------------------- void UCogAbilityWindow_Damages::RenderContent() { @@ -237,39 +236,36 @@ void UCogAbilityWindow_Damages::RenderContent() //-------------------------------------------------------------------------------------------------------------------------- void UCogAbilityWindow_Damages::OnSelectionChanged(AActor* OldSelection, AActor* NewSelection) { - if (ICogAbilityDamageActorInterface* DamageActor = Cast(OldSelection)) + if (ICogInterfacesDamageActor* DamageActor = Cast(OldSelection)) { DamageActor->OnDamageEvent().Remove(OnDamageEventDelegate); } - if (ICogAbilityDamageActorInterface* DamageActor = Cast(NewSelection)) + if (ICogInterfacesDamageActor* DamageActor = Cast(NewSelection)) { OnDamageEventDelegate = DamageActor->OnDamageEvent().AddUObject(this, &UCogAbilityWindow_Damages::OnDamageEvent); } } //-------------------------------------------------------------------------------------------------------------------------- -void UCogAbilityWindow_Damages::RenderTick(float DeltaSeconds) +void UCogAbilityWindow_Damages::GameTick(float DeltaSeconds) { - Super::RenderTick(DeltaSeconds); + Super::GameTick(DeltaSeconds); DamageReceivedStats.Tick(DeltaSeconds); DamageDealtStats.Tick(DeltaSeconds); } //-------------------------------------------------------------------------------------------------------------------------- -void UCogAbilityWindow_Damages::OnDamageEvent(const FCogAbilityDamageParams& Params) +void UCogAbilityWindow_Damages::OnDamageEvent(const FCogInterfacesDamageParams& Params) { - DamageDealtStats.Restart(); - DamageReceivedStats.Restart(); - AActor* Selection = GetSelection(); - if (Selection == Params.DamageDealer.Get()) + if (Params.Type == ECogInterfacesDamageEventType::DamageDealt) { - DamageDealtStats.AddDamage(Params.ReceivedDamage, Params.IncomingDamage, Params.IsCritical); + DamageDealtStats.AddDamage(Params.MitigatedDamage, Params.IncomingDamage, Params.IsCritical); } - else if (Selection == Params.DamageReceiver.Get()) + else if (Params.Type == ECogInterfacesDamageEventType::DamageReceived) { - DamageReceivedStats.AddDamage(Params.ReceivedDamage, Params.IncomingDamage, Params.IsCritical); + DamageReceivedStats.AddDamage(Params.MitigatedDamage, Params.IncomingDamage, Params.IsCritical); } } \ No newline at end of file diff --git a/Plugins/CogAbility/Source/CogAbility/Public/CogAbilityWindow_Damages.h b/Plugins/CogAbility/Source/CogAbility/Public/CogAbilityWindow_Damages.h index a64f459..2abad20 100644 --- a/Plugins/CogAbility/Source/CogAbility/Public/CogAbilityWindow_Damages.h +++ b/Plugins/CogAbility/Source/CogAbility/Public/CogAbilityWindow_Damages.h @@ -4,7 +4,7 @@ #include "CogWindow.h" #include "CogAbilityWindow_Damages.generated.h" -struct FCogAbilityDamageParams; +struct FCogInterfacesDamageParams; //-------------------------------------------------------------------------------------------------------------------------- class FCogDamageInstance @@ -52,17 +52,19 @@ class COGABILITY_API UCogAbilityWindow_Damages : public UCogWindow GENERATED_BODY() public: - UCogAbilityWindow_Damages(); - virtual void RenderContent() override; - virtual void RenderTick(float DeltaSeconds) override; protected: + + virtual void RenderContent() override; + + virtual void GameTick(float DeltaSeconds) override; + virtual void OnSelectionChanged(AActor* OldSelection, AActor* NewSelection) override; private: UFUNCTION() - void OnDamageEvent(const FCogAbilityDamageParams& Params); + void OnDamageEvent(const FCogInterfacesDamageParams& Params); FCogDamageStats DamageDealtStats; FCogDamageStats DamageReceivedStats; diff --git a/Plugins/CogDebug/CogDebug.uplugin b/Plugins/CogDebug/CogDebug.uplugin index 7f6bc71..3d1a827 100644 --- a/Plugins/CogDebug/CogDebug.uplugin +++ b/Plugins/CogDebug/CogDebug.uplugin @@ -30,6 +30,10 @@ { "Name": "CogImgui", "Enabled": true + }, + { + "Name": "CogInterfaces", + "Enabled": true } ] } \ No newline at end of file diff --git a/Plugins/CogDebug/Source/CogDebug/CogDebug.Build.cs b/Plugins/CogDebug/Source/CogDebug/CogDebug.Build.cs index c1ab114..30284bc 100644 --- a/Plugins/CogDebug/Source/CogDebug/CogDebug.Build.cs +++ b/Plugins/CogDebug/Source/CogDebug/CogDebug.Build.cs @@ -22,8 +22,9 @@ public class CogDebug : ModuleRules new string[] { "Core", - "CogImgui" - } + "CogImgui", + "CogInterfaces", + } ); diff --git a/Plugins/CogDebug/Source/CogDebug/Private/CogDebugLogCategoryManager.cpp b/Plugins/CogDebug/Source/CogDebug/Private/CogDebugLogCategoryManager.cpp index 8aefe18..536e34b 100644 --- a/Plugins/CogDebug/Source/CogDebug/Private/CogDebugLogCategoryManager.cpp +++ b/Plugins/CogDebug/Source/CogDebug/Private/CogDebugLogCategoryManager.cpp @@ -12,10 +12,37 @@ DEFINE_LOG_CATEGORY(LogCogServerDebug); TMap FCogDebugLogCategoryManager::LogCategories; + //-------------------------------------------------------------------------------------------------------------------------- -void FCogDebugLogCategoryManager::AddLogCategory(FLogCategoryBase& LogCategory) +// FCogDebugLogCategoryInfo +//-------------------------------------------------------------------------------------------------------------------------- +FString FCogDebugLogCategoryInfo::GetDisplayName() const { - LogCategories.Add(LogCategory.GetCategoryName(), FCogDebugLogCategoryInfo{ &LogCategory, ELogVerbosity::NumVerbosity }); + if (DisplayName.IsEmpty() == false) + { + return DisplayName; + } + + if (LogCategory != nullptr) + { + return LogCategory->GetCategoryName().ToString(); + } + + return FString("Invalid"); +} + +//-------------------------------------------------------------------------------------------------------------------------- +// FCogDebugLogCategoryManager +//-------------------------------------------------------------------------------------------------------------------------- +void FCogDebugLogCategoryManager::AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName) +{ + LogCategories.Add(LogCategory.GetCategoryName(), + FCogDebugLogCategoryInfo + { + &LogCategory, + ELogVerbosity::NumVerbosity, + DisplayName, + }); } //-------------------------------------------------------------------------------------------------------------------------- diff --git a/Plugins/CogDebug/Source/CogDebug/Private/CogDebugPlot.cpp b/Plugins/CogDebug/Source/CogDebug/Private/CogDebugPlot.cpp index 4ee7d03..4e2d82c 100644 --- a/Plugins/CogDebug/Source/CogDebug/Private/CogDebugPlot.cpp +++ b/Plugins/CogDebug/Source/CogDebug/Private/CogDebugPlot.cpp @@ -1,8 +1,8 @@ #include "CogDebugPlot.h" -#include "CogDebugFilteredActorInterface.h" #include "CogDebugDraw.h" #include "CogDebugHelper.h" +#include "CogInterfacesFilteredActor.h" #include "CogImguiHelper.h" FCogDebugPlotEvent FCogDebugPlot::DefaultEvent; @@ -427,7 +427,7 @@ FCogDebugPlotEntry* FCogDebugPlot::RegisterPlot(const UObject* WorldContextObjec //--------------------------------------------------------------------------------- // Cast to ICogActorFilteringDebugInterface to know if we should filter //--------------------------------------------------------------------------------- - if (Cast(WorldContextObject)) + if (Cast(WorldContextObject)) { if (WorldContextObject != FCogDebugSettings::GetSelection()) { diff --git a/Plugins/CogDebug/Source/CogDebug/Private/CogDebugSettings.cpp b/Plugins/CogDebug/Source/CogDebug/Private/CogDebugSettings.cpp index 9961ec8..e358496 100644 --- a/Plugins/CogDebug/Source/CogDebug/Private/CogDebugSettings.cpp +++ b/Plugins/CogDebug/Source/CogDebug/Private/CogDebugSettings.cpp @@ -1,5 +1,7 @@ #include "CogDebugSettings.h" +#include "CogInterfacesFilteredActor.h" + //-------------------------------------------------------------------------------------------------------------------------- TWeakObjectPtr FCogDebugSettings::Selection; bool FCogDebugSettings::FilterBySelection = true; @@ -72,7 +74,7 @@ bool FCogDebugSettings::IsDebugActiveForActor(const AActor* Actor) return true; } - if (Cast(Actor)) + if (Cast(Actor)) { return (SelectionPtr == Actor || FilterBySelection == false); } diff --git a/Plugins/CogDebug/Source/CogDebug/Public/CogDebugLogCategoryManager.h b/Plugins/CogDebug/Source/CogDebug/Public/CogDebugLogCategoryManager.h index ccbb266..2d15edb 100644 --- a/Plugins/CogDebug/Source/CogDebug/Public/CogDebugLogCategoryManager.h +++ b/Plugins/CogDebug/Source/CogDebug/Public/CogDebugLogCategoryManager.h @@ -13,12 +13,15 @@ struct COGDEBUG_API FCogDebugLogCategoryInfo { FLogCategoryBase* LogCategory = nullptr; ELogVerbosity::Type ServerVerbosity = ELogVerbosity::NoLogging; + FString DisplayName; + + FString GetDisplayName() const; }; //-------------------------------------------------------------------------------------------------------------------------- struct COGDEBUG_API FCogDebugLogCategoryManager { - static void AddLogCategory(FLogCategoryBase& LogCategory); + static void AddLogCategory(FLogCategoryBase& LogCategory, const FString& DisplayName = ""); static bool IsVerbosityActive(ELogVerbosity::Type Verbosity); diff --git a/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_LogCategories.cpp b/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_LogCategories.cpp index 1964445..717396c 100644 --- a/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_LogCategories.cpp +++ b/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_LogCategories.cpp @@ -71,7 +71,7 @@ void UCogEngineWindow_LogCategories::RenderContent() FLogCategoryBase* Category = CategoryInfo.LogCategory; ImGui::PushID(Index); - FString CategoryFriendlyName = Category->GetCategoryName().ToString(); + FString CategoryFriendlyName = CategoryInfo.GetDisplayName(); if (bShowAllVerbosity == false) { diff --git a/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_Stats.cpp b/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_Stats.cpp index 2d9e1cb..96ce3c5 100644 --- a/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_Stats.cpp +++ b/Plugins/CogEngine/Source/CogEngine/Private/CogEngineWindow_Stats.cpp @@ -46,8 +46,7 @@ void UCogEngineWindow_Stats::RenderContent() //-------------------------------------------------------------------------------------------------------------------------- void UCogEngineWindow_Stats::DrawMainMenuWidget(bool Draw, float& Width) { - const float ResetButtonWidth = FCogWindowWidgets::TextBaseWidth * 5; - Width = FCogWindowWidgets::TextBaseWidth * 15; + Width = FCogWindowWidgets::TextBaseWidth * 25; if (Draw == false) { @@ -56,6 +55,7 @@ void UCogEngineWindow_Stats::DrawMainMenuWidget(bool Draw, float& Width) extern ENGINE_API float GAverageFPS; ImGui::TextColored(GetFpsColor(GAverageFPS), "%3dfps ", (int32)GAverageFPS); + ImGui::SetItemTooltip("Frame Per Second"); if (const APlayerController* PlayerController = GetLocalPlayerController()) { @@ -64,6 +64,7 @@ void UCogEngineWindow_Stats::DrawMainMenuWidget(bool Draw, float& Width) const float Ping = PlayerState->GetPingInMilliseconds(); ImGui::SameLine(); ImGui::TextColored(GetPingColor(Ping), "%3dms ", (int32)Ping); + ImGui::SetItemTooltip("Ping"); } if (UNetConnection* Connection = PlayerController->GetNetConnection()) @@ -73,6 +74,7 @@ void UCogEngineWindow_Stats::DrawMainMenuWidget(bool Draw, float& Width) const float TotalPacketLost = OutPacketLost + InPacketLost; ImGui::SameLine(); ImGui::TextColored(GetPacketLossColor(TotalPacketLost), "%2d%% ", (int32)TotalPacketLost); + ImGui::SetItemTooltip("Packet Loss"); } } } diff --git a/Plugins/CogInterfaces/CogInterfaces.uplugin b/Plugins/CogInterfaces/CogInterfaces.uplugin new file mode 100644 index 0000000..4b4c3e7 --- /dev/null +++ b/Plugins/CogInterfaces/CogInterfaces.uplugin @@ -0,0 +1,26 @@ +{ + "FileVersion": 1, + "Version": 1, + "VersionName": "1.0", + "FriendlyName": "CogInterfaces", + "Description": "", + "Category": "Other", + "CreatedBy": "Arnaud Jamin", + "CreatedByURL": "", + "DocsURL": "", + "MarketplaceURL": "", + "SupportURL": "", + "CanContainContent": true, + "IsBetaVersion": false, + "IsExperimentalVersion": false, + "Installed": false, + "Modules": [ + { + "Name": "CogInterfaces", + "Type": "Runtime", + "LoadingPhase": "Default" + } + ], + "Plugins": [ + ] +} \ No newline at end of file diff --git a/Plugins/CogInterfaces/Resources/Icon128.png b/Plugins/CogInterfaces/Resources/Icon128.png new file mode 100644 index 0000000..1231d4a Binary files /dev/null and b/Plugins/CogInterfaces/Resources/Icon128.png differ diff --git a/Plugins/CogInterfaces/Source/CogInterfaces/CogInterfaces.Build.cs b/Plugins/CogInterfaces/Source/CogInterfaces/CogInterfaces.Build.cs new file mode 100644 index 0000000..68c66ac --- /dev/null +++ b/Plugins/CogInterfaces/Source/CogInterfaces/CogInterfaces.Build.cs @@ -0,0 +1,44 @@ +using UnrealBuildTool; + +public class CogInterfaces : ModuleRules +{ + public CogInterfaces(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicIncludePaths.AddRange( + new string[] { + } + ); + + + PrivateIncludePaths.AddRange( + new string[] { + } + ); + + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + } + ); + + + PrivateDependencyModuleNames.AddRange( + new string[] + { + "CoreUObject", + "Engine", + } + ); + + + DynamicallyLoadedModuleNames.AddRange( + new string[] + { + } + ); + } +} diff --git a/Plugins/CogInterfaces/Source/CogInterfaces/Private/CogInterfacesModule.cpp b/Plugins/CogInterfaces/Source/CogInterfaces/Private/CogInterfacesModule.cpp new file mode 100644 index 0000000..2a66e3b --- /dev/null +++ b/Plugins/CogInterfaces/Source/CogInterfaces/Private/CogInterfacesModule.cpp @@ -0,0 +1,17 @@ +#include "CogInterfacesModule.h" + +#define LOCTEXT_NAMESPACE "FCogInterfacesModule" + +//-------------------------------------------------------------------------------------------------------------------------- +void FCogInterfacesModule::StartupModule() +{ +} + +//-------------------------------------------------------------------------------------------------------------------------- +void FCogInterfacesModule::ShutdownModule() +{ +} + +#undef LOCTEXT_NAMESPACE + +IMPLEMENT_MODULE(FCogInterfacesModule, CogInterfaces) \ No newline at end of file diff --git a/Plugins/CogDebug/Source/CogDebug/Public/CogDebugAllegianceInterface.h b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesAllegiance.h similarity index 67% rename from Plugins/CogDebug/Source/CogDebug/Public/CogDebugAllegianceInterface.h rename to Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesAllegiance.h index 13466d0..f0ca125 100644 --- a/Plugins/CogDebug/Source/CogDebug/Public/CogDebugAllegianceInterface.h +++ b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesAllegiance.h @@ -1,11 +1,11 @@ #pragma once #include "CoreMinimal.h" -#include "CogDebugAllegianceInterface.generated.h" +#include "CogInterfacesAllegiance.generated.h" //-------------------------------------------------------------------------------------------------------------------------- UENUM(BlueprintType) -enum class ECogAllegiance : uint8 +enum class ECogInterfacesAllegiance : uint8 { Ally, Enemy @@ -13,17 +13,17 @@ enum class ECogAllegiance : uint8 //-------------------------------------------------------------------------------------------------------------------------- UINTERFACE(MinimalAPI, Blueprintable) -class UCogAllegianceInterface : public UInterface +class UCogInterfacesAllegianceActor : public UInterface { GENERATED_BODY() }; //-------------------------------------------------------------------------------------------------------------------------- -class ICogAllegianceInterface +class ICogInterfacesAllegianceActor { GENERATED_BODY() public: - virtual ECogAllegiance GetAllegiance(const AActor* OtherActor) const = 0; + virtual ECogInterfacesAllegiance GetAllegiance(const AActor* OtherActor) const = 0; }; \ No newline at end of file diff --git a/Plugins/CogAbility/Source/CogAbility/Public/CogAbilityDamageActorInterface.h b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesDamageActor.h similarity index 64% rename from Plugins/CogAbility/Source/CogAbility/Public/CogAbilityDamageActorInterface.h rename to Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesDamageActor.h index e09d853..c67c20b 100644 --- a/Plugins/CogAbility/Source/CogAbility/Public/CogAbilityDamageActorInterface.h +++ b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesDamageActor.h @@ -1,33 +1,43 @@ #pragma once #include "CoreMinimal.h" -#include "CogAbilityDamageActorInterface.generated.h" +#include "CogInterfacesDamageActor.generated.h" + +//-------------------------------------------------------------------------------------------------------------------------- +UENUM(BlueprintType) +enum class ECogInterfacesDamageEventType : uint8 +{ + DamageDealt, + DamageReceived, +}; + //-------------------------------------------------------------------------------------------------------------------------- USTRUCT() -struct COGABILITY_API FCogAbilityDamageParams +struct FCogInterfacesDamageParams { GENERATED_BODY() + ECogInterfacesDamageEventType Type; TObjectPtr DamageDealer; TObjectPtr DamageReceiver; - float ReceivedDamage = 0; + float MitigatedDamage = 0; float IncomingDamage = 0; bool IsCritical = false; }; //-------------------------------------------------------------------------------------------------------------------------- -DECLARE_MULTICAST_DELEGATE_OneParam(FCogAbilityOnDamageEvent, const FCogAbilityDamageParams&); +DECLARE_MULTICAST_DELEGATE_OneParam(FCogAbilityOnDamageEvent, const FCogInterfacesDamageParams&); //-------------------------------------------------------------------------------------------------------------------------- UINTERFACE(MinimalAPI, Blueprintable) -class UCogAbilityDamageActorInterface : public UInterface +class UCogInterfacesDamageActor : public UInterface { GENERATED_BODY() }; //-------------------------------------------------------------------------------------------------------------------------- -class ICogAbilityDamageActorInterface +class ICogInterfacesDamageActor { GENERATED_BODY() diff --git a/Plugins/CogDebug/Source/CogDebug/Public/CogDebugFilteredActorInterface.h b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesFilteredActor.h similarity index 56% rename from Plugins/CogDebug/Source/CogDebug/Public/CogDebugFilteredActorInterface.h rename to Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesFilteredActor.h index f9a2ccf..fc2822e 100644 --- a/Plugins/CogDebug/Source/CogDebug/Public/CogDebugFilteredActorInterface.h +++ b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesFilteredActor.h @@ -1,15 +1,15 @@ #pragma once #include "CoreMinimal.h" -#include "CogDebugFilteredActorInterface.generated.h" +#include "CogInterfacesFilteredActor.generated.h" UINTERFACE(MinimalAPI, Blueprintable) -class UCogDebugFilteredActorInterface : public UInterface +class UCogInterfacesFilteredActor : public UInterface { GENERATED_BODY() }; -class ICogDebugFilteredActorInterface +class ICogInterfacesFilteredActor { GENERATED_BODY() diff --git a/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesModule.h b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesModule.h new file mode 100644 index 0000000..9d22e37 --- /dev/null +++ b/Plugins/CogInterfaces/Source/CogInterfaces/Public/CogInterfacesModule.h @@ -0,0 +1,17 @@ +#pragma once + +#include "CoreMinimal.h" +#include "Modules/ModuleManager.h" + +class COGINTERFACES_API FCogInterfacesModule : public IModuleInterface +{ +public: + + static inline FCogInterfacesModule& Get() { return FModuleManager::LoadModuleChecked("CogInterfaces"); } + + virtual void StartupModule() override; + + virtual void ShutdownModule() override; + +private: +}; diff --git a/Source/CogSample/CogSample.Build.cs b/Source/CogSample/CogSample.Build.cs index e024d09..d1524c8 100644 --- a/Source/CogSample/CogSample.Build.cs +++ b/Source/CogSample/CogSample.Build.cs @@ -25,6 +25,7 @@ public class CogSample : ModuleRules PublicDependencyModuleNames.AddRange(new string[] { "CogImgui", + "CogInterfaces", "CogWindow", "CogEngine", "CogInput", diff --git a/Source/CogSample/CogSampleCharacter.cpp b/Source/CogSample/CogSampleCharacter.cpp index 0a1b0da..2a8e9c0 100644 --- a/Source/CogSample/CogSampleCharacter.cpp +++ b/Source/CogSample/CogSampleCharacter.cpp @@ -348,8 +348,9 @@ void ACogSampleCharacter::Look(const FInputActionValue& Value) void ACogSampleCharacter::OnDamageReceived(float ReceivedDamage, float IncomingDamage, AActor* DamageDealer, const FGameplayEffectSpec& EffectSpec) { #if USE_COG - FCogAbilityDamageParams Params; - Params.ReceivedDamage = ReceivedDamage; + FCogInterfacesDamageParams Params; + Params.Type = ECogInterfacesDamageEventType::DamageReceived; + Params.MitigatedDamage = ReceivedDamage; Params.IncomingDamage = IncomingDamage; Params.DamageDealer = DamageDealer; Params.DamageReceiver = this; @@ -361,8 +362,9 @@ void ACogSampleCharacter::OnDamageReceived(float ReceivedDamage, float IncomingD void ACogSampleCharacter::OnDamageDealt(float ReceivedDamage, float IncomingDamage, AActor* DamageReceiver, const FGameplayEffectSpec& EffectSpec) { #if USE_COG - FCogAbilityDamageParams Params; - Params.ReceivedDamage = ReceivedDamage; + FCogInterfacesDamageParams Params; + Params.Type = ECogInterfacesDamageEventType::DamageDealt; + Params.MitigatedDamage = ReceivedDamage; Params.IncomingDamage = IncomingDamage; Params.DamageDealer = this; Params.DamageReceiver = DamageReceiver; diff --git a/Source/CogSample/CogSampleCharacter.h b/Source/CogSample/CogSampleCharacter.h index f929d31..2b845ba 100644 --- a/Source/CogSample/CogSampleCharacter.h +++ b/Source/CogSample/CogSampleCharacter.h @@ -1,20 +1,16 @@ #pragma once #include "CoreMinimal.h" -#include "CogDefines.h" #include "AbilitySystemInterface.h" #include "ActiveGameplayEffectHandle.h" #include "AttributeSet.h" +#include "CogDefines.h" +#include "CogInterfacesDamageActor.h" +#include "CogInterfacesFilteredActor.h" #include "GameFramework/Character.h" #include "GameplayAbilitySpecHandle.h" #include "GameplayTagContainer.h" #include "InputActionValue.h" - -#if USE_COG -#include "CogAbilityDamageActorInterface.h" -#include "CogDebugFilteredActorInterface.h" -#endif //USE_COG - #include "CogSampleCharacter.generated.h" class UAbilitySystemComponent; @@ -62,10 +58,8 @@ public: UCLASS(config=Game) class ACogSampleCharacter : public ACharacter , public IAbilitySystemInterface -#if USE_COG - , public ICogDebugFilteredActorInterface - , public ICogAbilityDamageActorInterface -#endif //USE_COG + , public ICogInterfacesFilteredActor + , public ICogInterfacesDamageActor { GENERATED_BODY() @@ -81,11 +75,8 @@ public: virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; virtual void PossessedBy(AController* NewController) override; -#if USE_COG virtual FCogAbilityOnDamageEvent& OnDamageEvent() override { return OnDamageEventDelegate; } virtual bool IsActorFilteringDebug() const override { return true; } -#endif //USE_COG - void OnAcknowledgePossession(APlayerController* InController); @@ -155,9 +146,7 @@ public: UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability) TArray> Effects; -#if USE_COG FCogAbilityOnDamageEvent OnDamageEventDelegate; -#endif //USE_COG private: diff --git a/Source/CogSample/CogSampleCharacterMovementComponent.cpp b/Source/CogSample/CogSampleCharacterMovementComponent.cpp index b3eb271..fb6b02e 100644 --- a/Source/CogSample/CogSampleCharacterMovementComponent.cpp +++ b/Source/CogSample/CogSampleCharacterMovementComponent.cpp @@ -233,11 +233,13 @@ void UCogSampleCharacterMovementComponent::TickComponent(float DeltaTime, enum E #if ENABLE_COG - const FVector DebugBottomLocation = Character->GetActorLocation() - FVector::UpVector * CapsuleComponent->GetScaledCapsuleHalfHeight(); + const FVector DebugLocation = Character->GetActorLocation(); + const FVector DebugBottomLocation = DebugLocation - FVector::UpVector * CapsuleComponent->GetScaledCapsuleHalfHeight(); if (FCogDebugSettings::IsDebugActiveForActor(GetPawnOwner())) { const FRotator Rotation = Character->GetActorRotation(); + const FVector Forward = Character->GetActorForwardVector(); const FVector LocalVelocity = Rotation.UnrotateVector(Velocity); const FVector LocalAcceleration = Rotation.UnrotateVector(GetCurrentAcceleration()); const FVector VelocityDelta = (Velocity - DebugLastVelocity) / DeltaTime; @@ -275,8 +277,12 @@ void UCogSampleCharacterMovementComponent::TickComponent(float DeltaTime, enum E } const FColor CapsuleColor = CapsuleComponent->GetCollisionEnabled() == ECollisionEnabled::NoCollision ? FColor::Black : FColor::White; - FCogDebugDraw::Capsule(LogCogCollision, this, CapsuleComponent->GetComponentLocation(), CapsuleComponent->GetScaledCapsuleHalfHeight(), CapsuleComponent->GetScaledCapsuleRadius(), CapsuleComponent->GetComponentQuat(), CapsuleColor, false, 0); - FCogDebugDraw::Axis(LogCogCollision, this, CapsuleComponent->GetComponentLocation(), CapsuleComponent->GetComponentRotation(), 50.0f, false, 0); + FCogDebugDraw::Capsule(LogCogCollision, Character, CapsuleComponent->GetComponentLocation(), CapsuleComponent->GetScaledCapsuleHalfHeight(), CapsuleComponent->GetScaledCapsuleRadius(), CapsuleComponent->GetComponentQuat(), CapsuleColor, false, 0); + FCogDebugDraw::Axis(LogCogCollision, Character, CapsuleComponent->GetComponentLocation(), CapsuleComponent->GetComponentRotation(), 50.0f, false, 0); + FCogDebugDraw::Arrow(LogCogRotation, Character, DebugLocation, DebugLocation + Rotation.Vector() * 100.0f, FColor::Green, true, 0); + FCogDebugDraw::Arrow(LogCogControlRotation, Character, DebugLocation, DebugLocation + Character->GetControlRotation().Vector() * 100.f, FColor::Silver, true, 0); + FCogDebugDraw::Arrow(LogCogBaseAimRotation, Character, DebugLocation, DebugLocation + Character->GetBaseAimRotation().Vector() * 100.f, FColor::Red, true, 0); + FCogDebugDraw::Skeleton(LogCogSkeleton, Character->GetMesh(), FColor::White, false, 1); } DebugLastBottomLocation = DebugBottomLocation; diff --git a/Source/CogSample/CogSampleLogCategories.cpp b/Source/CogSample/CogSampleLogCategories.cpp index 152ad29..a1b2a81 100644 --- a/Source/CogSample/CogSampleLogCategories.cpp +++ b/Source/CogSample/CogSampleLogCategories.cpp @@ -10,17 +10,25 @@ DEFINE_LOG_CATEGORY(LogCogCollision); DEFINE_LOG_CATEGORY(LogCogInput); DEFINE_LOG_CATEGORY(LogCogPosition); +DEFINE_LOG_CATEGORY(LogCogRotation); +DEFINE_LOG_CATEGORY(LogCogControlRotation); +DEFINE_LOG_CATEGORY(LogCogBaseAimRotation); +DEFINE_LOG_CATEGORY(LogCogSkeleton); namespace CogSampleLog { void RegiterAllLogCategories() { #if USE_COG - FCogDebugLogCategoryManager::AddLogCategory(LogAbilitySystem); - FCogDebugLogCategoryManager::AddLogCategory(LogGameplayEffects); - FCogDebugLogCategoryManager::AddLogCategory(LogCogCollision); - FCogDebugLogCategoryManager::AddLogCategory(LogCogInput); - FCogDebugLogCategoryManager::AddLogCategory(LogCogPosition); + FCogDebugLogCategoryManager::AddLogCategory(LogAbilitySystem, "AbilitySystem"); + FCogDebugLogCategoryManager::AddLogCategory(LogGameplayEffects, "Gameplay Effects"); + FCogDebugLogCategoryManager::AddLogCategory(LogCogCollision, "Collision"); + FCogDebugLogCategoryManager::AddLogCategory(LogCogInput, "Input"); + FCogDebugLogCategoryManager::AddLogCategory(LogCogPosition, "Position"); + FCogDebugLogCategoryManager::AddLogCategory(LogCogRotation, "Rotation"); + FCogDebugLogCategoryManager::AddLogCategory(LogCogControlRotation, "ControlRotation"); + FCogDebugLogCategoryManager::AddLogCategory(LogCogBaseAimRotation, "BaseAimRotation"); + FCogDebugLogCategoryManager::AddLogCategory(LogCogSkeleton, "Skeleton"); #endif //USE_COG } } diff --git a/Source/CogSample/CogSampleLogCategories.h b/Source/CogSample/CogSampleLogCategories.h index 353e364..7c4dd88 100644 --- a/Source/CogSample/CogSampleLogCategories.h +++ b/Source/CogSample/CogSampleLogCategories.h @@ -3,6 +3,10 @@ DECLARE_LOG_CATEGORY_EXTERN(LogCogCollision, Warning, All); DECLARE_LOG_CATEGORY_EXTERN(LogCogInput, Warning, All); DECLARE_LOG_CATEGORY_EXTERN(LogCogPosition, Warning, All); +DECLARE_LOG_CATEGORY_EXTERN(LogCogRotation, Warning, All); +DECLARE_LOG_CATEGORY_EXTERN(LogCogControlRotation, Warning, All); +DECLARE_LOG_CATEGORY_EXTERN(LogCogBaseAimRotation, Warning, All); +DECLARE_LOG_CATEGORY_EXTERN(LogCogSkeleton, Warning, All); namespace CogSampleLog {