mirror of
https://github.com/Ed94/Cog.git
synced 2026-07-28 18:30:04 +00:00
Add CogInterfaces plugin to fix interface usage when compiling shipping builds
This commit is contained in:
@@ -25,6 +25,7 @@ public class CogSample : ModuleRules
|
||||
PublicDependencyModuleNames.AddRange(new string[]
|
||||
{
|
||||
"CogImgui",
|
||||
"CogInterfaces",
|
||||
"CogWindow",
|
||||
"CogEngine",
|
||||
"CogInput",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<TSubclassOf<UGameplayEffect>> Effects;
|
||||
|
||||
#if USE_COG
|
||||
FCogAbilityOnDamageEvent OnDamageEventDelegate;
|
||||
#endif //USE_COG
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user