hud initialization fixes

This commit is contained in:
Arnaud Jamin
2023-10-07 01:57:42 -04:00
parent b18e62cd02
commit 3e6288c955
23 changed files with 363 additions and 88 deletions
+98 -33
View File
@@ -82,6 +82,15 @@ void ACogSampleCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >
DOREPLIFETIME_WITH_PARAMS_FAST(ACogSampleCharacter, Team, Params);
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::PostInitializeComponents()
{
Super::PostInitializeComponents();
InitializeAbilitySystem();
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::BeginPlay()
{
@@ -117,19 +126,83 @@ UAbilitySystemComponent* ACogSampleCharacter::GetAbilitySystemComponent() const
return AbilitySystem;
}
//--------------------------------------------------------------------------------------------------------------------------
ECogInterfacesAllegiance ACogSampleCharacter::GetAllegianceWithOtherActor(const AActor* OtherActor) const
{
ECogSampleAllegiance Allegiance = UCogSampleFunctionLibrary_Team::GetActorsAllegiance(this, OtherActor);
switch (Allegiance)
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::PossessedBy(AController* NewController)
{
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT("Controller:%s"), *GetNameSafe(NewController));
if (InitialController == nullptr)
{
case ECogSampleAllegiance::Enemy: return ECogInterfacesAllegiance::Enemy;
case ECogSampleAllegiance::Friendly: return ECogInterfacesAllegiance::Friendly;
case ECogSampleAllegiance::Neutral: return ECogInterfacesAllegiance::Neutral;
InitialController = NewController;
}
return ECogInterfacesAllegiance::Neutral;
Super::PossessedBy(NewController);
if (bIsInitialized == false)
{
InitializeAbilitySystem();
}
else
{
//-------------------------------------------------------------------------------------------
// When possessing a NPC, we need to refresh the ability system actor info, so it knows about
// the new controller to be able to activate abilities.
//-------------------------------------------------------------------------------------------
AbilitySystem->InitAbilityActorInfo(this, this);
//-------------------------------------------------------------------------------------------
// We might be possessed when in a middle of an ability. Currently we prefer to cancel it.
//-------------------------------------------------------------------------------------------
AbilitySystem->CancelAllAbilities();
if (UCogSampleCharacterMovementComponent* MovementComp = Cast<UCogSampleCharacterMovementComponent>(GetMovementComponent()))
{
MovementComp->PossessedBy(NewController);
}
}
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::UnPossessed()
{
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT(""));
if (UCogSampleCharacterMovementComponent* MovementComp = Cast<UCogSampleCharacterMovementComponent>(GetMovementComponent()))
{
MovementComp->UnPossessed();
}
Super::UnPossessed();
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::AcknowledgePossession(AController* NewController)
{
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT("Controller:%s - NewController:%s"), *GetNameSafe(NewController), *GetNameSafe(Controller));
//-------------------------------------------------------------------------------------------
// Set the controller otherwise when the player possesses a NPC, he would not be able to cast
// any ability. The ability system component needs to know the controller and therefore it
// needs to be set before calling InitAbilityActorInfo.
// See FGameplayAbilityActorInfo::InitFromActor
//-------------------------------------------------------------------------------------------
Controller = NewController;
if (AbilitySystem != nullptr)
{
AbilitySystem->InitAbilityActorInfo(this, this);
}
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::AcknowledgeUnpossession()
{
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT("OldController:%s"), *GetNameSafe(Controller));
Controller = nullptr;
AbilitySystem->InitAbilityActorInfo(this, this);
}
//--------------------------------------------------------------------------------------------------------------------------
@@ -221,11 +294,6 @@ void ACogSampleCharacter::TryFinishInitialize()
return;
}
if (bIsAbilitySystemInitialized == false)
{
return;
}
if (HasActorBegunPlay() == false)
{
return;
@@ -262,19 +330,6 @@ void ACogSampleCharacter::ShutdownAbilitySystem()
AbilitySystem->ClearActorInfo();
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
InitializeAbilitySystem();
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::OnAcknowledgePossession(APlayerController* InController)
{
InitializeAbilitySystem();
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
@@ -420,6 +475,21 @@ void ACogSampleCharacter::Look(const FInputActionValue& Value)
}
}
//--------------------------------------------------------------------------------------------------------------------------
ECogInterfacesAllegiance ACogSampleCharacter::GetAllegianceWithOtherActor(const AActor* OtherActor) const
{
ECogSampleAllegiance Allegiance = UCogSampleFunctionLibrary_Team::GetActorsAllegiance(this, OtherActor);
switch (Allegiance)
{
case ECogSampleAllegiance::Enemy: return ECogInterfacesAllegiance::Enemy;
case ECogSampleAllegiance::Friendly: return ECogInterfacesAllegiance::Friendly;
case ECogSampleAllegiance::Neutral: return ECogInterfacesAllegiance::Neutral;
}
return ECogInterfacesAllegiance::Neutral;
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::HandleDamageReceived(const FCogSampleDamageEventParams& Params)
{
@@ -435,11 +505,6 @@ void ACogSampleCharacter::HandleDamageDealt(const FCogSampleDamageEventParams& P
{
OnDamageDealt.Broadcast(Params);
if (ACogSamplePlayerController* PlayerController = Cast<ACogSamplePlayerController>(GetController()))
{
PlayerController->OnPawnDealtDamage.Broadcast(Params);
}
#if USE_COG
FCogDebugMetric::AddMetric(this, "Damage Dealt", Params.MitigatedDamage, Params.UnmitigatedDamage, false);
#endif //USE_COG
+12 -1
View File
@@ -79,6 +79,8 @@ public:
// ACharacter overrides
//----------------------------------------------------------------------------------------------------------------------
virtual void PostInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
@@ -89,7 +91,11 @@ public:
virtual void PossessedBy(AController* NewController) override;
void OnAcknowledgePossession(APlayerController* InController);
virtual void UnPossessed() override;
virtual void AcknowledgePossession(AController* NewController);
virtual void AcknowledgeUnpossession();
//----------------------------------------------------------------------------------------------------------------------
// IAbilitySystemInterface overrides
@@ -215,6 +221,11 @@ public:
int32 ApplyRootMotion(const FCogSampleRootMotionParams& Params);
private:
friend class ACogSamplePlayerController;
UPROPERTY()
AController* InitialController = nullptr;
//----------------------------------------------------------------------------------------------------------------------
// Inputs
@@ -305,3 +305,26 @@ bool UCogSampleCharacterMovementComponent::ClientUpdatePositionAfterServerUpdate
return Result;
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogSampleCharacterMovementComponent::PossessedBy(AController* NewController)
{
if (NewController != nullptr && NewController->IsPlayerController())
{
bWasAvoidanceEnabled = bUseRVOAvoidance;
SetAvoidanceEnabled(false);
}
else
{
SetAvoidanceEnabled(bWasAvoidanceEnabled);
}
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogSampleCharacterMovementComponent::UnPossessed()
{
//---------------------------------------------------------------------------------------
// Make sure the character doesn't keep his velocity while not controlled anymore.
//---------------------------------------------------------------------------------------
ConsumeInputVector();
}
@@ -5,12 +5,60 @@
#include "GameFramework/CharacterMovementComponent.h"
#include "CogSampleCharacterMovementComponent.generated.h"
class AController;
//--------------------------------------------------------------------------------------------------------------------------
UCLASS()
class UCogSampleCharacterMovementComponent : public UCharacterMovementComponent
{
GENERATED_BODY()
public:
virtual void BeginPlay() override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual float GetMaxSpeed() const override;
virtual float GetMaxAcceleration() const override;
virtual FRotator GetDeltaRotation(float DeltaTime) const;
virtual void UpdateFromCompressedFlags(uint8 Flags) override;
virtual class FNetworkPredictionData_Client* GetPredictionData_Client() const override;
virtual bool ClientUpdatePositionAfterServerUpdate() override;
virtual void PossessedBy(AController* NewController);
virtual void UnPossessed();
UFUNCTION(BlueprintCallable)
void StartSprinting();
UFUNCTION(BlueprintCallable)
void StopSprinting();
private:
bool bIsSprinting = false;
bool bWasAvoidanceEnabled = false;
#if USE_COG
FVector DebugLastBottomLocation = FVector::ZeroVector;
FVector DebugLastVelocity = FVector::ZeroVector;
bool DebugIsPositionCorrected = false;
#endif //USE_COG
//----------------------------------------------------------------------------------------------------------------------
class FCogSampleSavedMove : public FSavedMove_Character
{
public:
@@ -29,7 +77,7 @@ class UCogSampleCharacterMovementComponent : public UCharacterMovementComponent
///@brief Sets up the move before sending it to the server.
virtual void SetMoveFor(ACharacter* Character, float InDeltaTime, FVector const& NewAccel, class FNetworkPredictionData_Client_Character& ClientData) override;
///@brief Sets variables on character movement component before making a predictive correction.
virtual void PrepMoveFor(class ACharacter* Character) override;
@@ -37,6 +85,7 @@ class UCogSampleCharacterMovementComponent : public UCharacterMovementComponent
uint8 SavedRequestSprint : 1;
};
//----------------------------------------------------------------------------------------------------------------------
class FCogSampleNetworkPredictionData_Client : public FNetworkPredictionData_Client_Character
{
public:
@@ -47,30 +96,4 @@ class UCogSampleCharacterMovementComponent : public UCharacterMovementComponent
///@brief Allocates a new copy of our custom saved move
virtual FSavedMovePtr AllocateNewMove() override;
};
public:
virtual void BeginPlay() override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual float GetMaxSpeed() const override;
virtual float GetMaxAcceleration() const override;
virtual FRotator GetDeltaRotation(float DeltaTime) const;
virtual void UpdateFromCompressedFlags(uint8 Flags) override;
virtual class FNetworkPredictionData_Client* GetPredictionData_Client() const override;
virtual bool ClientUpdatePositionAfterServerUpdate() override;
UFUNCTION(BlueprintCallable)
void StartSprinting();
UFUNCTION(BlueprintCallable)
void StopSprinting();
private:
bool bIsSprinting = false;
#if USE_COG
FVector DebugLastBottomLocation = FVector::ZeroVector;
FVector DebugLastVelocity = FVector::ZeroVector;
bool DebugIsPositionCorrected = false;
#endif //USE_COG
};
+11 -5
View File
@@ -8,12 +8,15 @@
#endif //USE_COG
DEFINE_LOG_CATEGORY(LogCogAlways);
DEFINE_LOG_CATEGORY(LogCogAbility);
DEFINE_LOG_CATEGORY(LogCogBaseAimRotation);
DEFINE_LOG_CATEGORY(LogCogCollision);
DEFINE_LOG_CATEGORY(LogCogControlRotation);
DEFINE_LOG_CATEGORY(LogCogInput);
DEFINE_LOG_CATEGORY(LogCogPosition);
DEFINE_LOG_CATEGORY(LogCogPossession);
DEFINE_LOG_CATEGORY(LogCogRotation);
DEFINE_LOG_CATEGORY(LogCogControlRotation);
DEFINE_LOG_CATEGORY(LogCogBaseAimRotation);
DEFINE_LOG_CATEGORY(LogCogSkeleton);
DEFINE_LOG_CATEGORY(LogCogTargetAcquisition);
@@ -23,16 +26,19 @@ namespace CogSampleLog
{
#if USE_COG
FCogDebugLog::AddLogCategory(LogCogAlways, "Always", false);
FCogDebugLog::AddLogCategory(LogCogAbility, "Ability");
FCogDebugLog::AddLogCategory(LogAbilitySystem, "Ability System");
FCogDebugLog::AddLogCategory(LogGameplayEffects, "Gameplay Effects");
FCogDebugLog::AddLogCategory(LogCogBaseAimRotation, "BaseAimRotation");
FCogDebugLog::AddLogCategory(LogCogCollision, "Collision");
FCogDebugLog::AddLogCategory(LogCogControlRotation, "ControlRotation");
FCogDebugLog::AddLogCategory(LogCogInput, "Input");
FCogDebugLog::AddLogCategory(LogCogPosition, "Position");
FCogDebugLog::AddLogCategory(LogCogPossession, "Possession");
FCogDebugLog::AddLogCategory(LogCogRotation, "Rotation");
FCogDebugLog::AddLogCategory(LogCogControlRotation, "ControlRotation");
FCogDebugLog::AddLogCategory(LogCogBaseAimRotation, "BaseAimRotation");
FCogDebugLog::AddLogCategory(LogCogSkeleton, "Skeleton");
FCogDebugLog::AddLogCategory(LogCogTargetAcquisition, "Target Acquisition");
FCogDebugLog::AddLogCategory(LogGameplayEffects, "Gameplay Effects");
#endif //USE_COG
}
}
+5 -2
View File
@@ -1,12 +1,15 @@
#include "CoreMinimal.h"
DECLARE_LOG_CATEGORY_EXTERN(LogCogAlways, VeryVerbose, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCogAbility, Warning, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCogBaseAimRotation, Warning, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCogCollision, Warning, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCogControlRotation, Warning, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCogInput, Warning, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCogPosition, Warning, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCogPossession, 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);
DECLARE_LOG_CATEGORY_EXTERN(LogCogTargetAcquisition, Warning, All);
+122 -11
View File
@@ -1,7 +1,9 @@
#include "CogSamplePlayerController.h"
#include "CogDebugLogMacros.h"
#include "CogDefines.h"
#include "CogSampleCharacter.h"
#include "CogSampleLogCategories.h"
#include "CogSampleTargetAcquisition.h"
#include "Net/UnrealNetwork.h"
@@ -12,7 +14,6 @@
#include "CogEngineReplicator.h"
#endif //USE_COG
//--------------------------------------------------------------------------------------------------------------------------
ACogSamplePlayerController::ACogSamplePlayerController()
{
@@ -31,14 +32,115 @@ void ACogSamplePlayerController::BeginPlay()
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSamplePlayerController::AcknowledgePossession(APawn* P)
void ACogSamplePlayerController::OnPossess(APawn* InPawn)
{
Super::AcknowledgePossession(P);
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT(""));
if (ACogSampleCharacter* PossessedCharacter = Cast<ACogSampleCharacter>(P))
ACogSampleCharacter* OldControlledCharacter = Cast<ACogSampleCharacter>(GetPawn());
//----------------------------------------------------------------------------------------------------------
// Case of pawn was possessed too early by the server before a join complete
//----------------------------------------------------------------------------------------------------------
if (InPawn != nullptr && InPawn->Controller != nullptr)
{
PossessedCharacter->OnAcknowledgePossession(this);
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Warning, this, TEXT("Asking %s to possess pawn %s more than once. Pawn will be restarted! Should call Unpossess first if possible."), *GetNameSafe(this), *GetNameSafe(InPawn));
InPawn->Controller->UnPossess();
}
Super::OnPossess(InPawn);
if (InPawn != nullptr)
{
//on server, the pawn are not possessed on begin play callback, need to do it here.
if (IsLocalController())
{
SetControlRotation(InPawn->GetActorRotation());
}
}
ControlledCharacter = Cast<ACogSampleCharacter>(InPawn);
if (InitialControlledCharacter == nullptr)
{
InitialControlledCharacter = ControlledCharacter;
}
OnControlledCharacterChanged.Broadcast(this, ControlledCharacter.Get(), OldControlledCharacter);
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSamplePlayerController::AcknowledgePossession(APawn* NewPawn)
{
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT(""));
ACogSampleCharacter* OldControlledCharacter = Cast<ACogSampleCharacter>(AcknowledgedPawn);
Super::AcknowledgePossession(NewPawn);
if (InitialControlledCharacter == nullptr)
{
InitialControlledCharacter = Cast<ACogSampleCharacter>(NewPawn);
}
if (ControlledCharacter != nullptr)
{
ControlledCharacter->AcknowledgeUnpossession();
}
ControlledCharacter = Cast<ACogSampleCharacter>(NewPawn);
ControlledCharacter->AcknowledgePossession(this);
OnControlledCharacterChanged.Broadcast(this, ControlledCharacter.Get(), OldControlledCharacter);
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSamplePlayerController::ControlCharacter(ACogSampleCharacter* NewCharacter)
{
if (NewCharacter == nullptr || GetPawn() == NewCharacter)
{
return;
}
//-------------------------------------------------------------------------------------------
// Unplug the current controller so it doesn't conflict with the newly assigned controller
//-------------------------------------------------------------------------------------------
AController* OldController = NewCharacter->GetController();
if (OldController != nullptr)
{
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT("%s unpossess %s"), *GetNameSafe(OldController), *GetNameSafe(NewCharacter));
OldController->UnPossess();
}
//-------------------------------------------------------------------------------------------
// We will need to replug the initial controller of the character we currently control
//-------------------------------------------------------------------------------------------
ACogSampleCharacter* OldCharacter = Cast<ACogSampleCharacter>(GetPawn());
//-------------------------------------------------------------------------------------------
// Unpossess before possession to prevent a warning
//-------------------------------------------------------------------------------------------
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT("%s unpossess %s"), *GetNameSafe(this), *GetNameSafe(GetPawn()));
UnPossess();
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT("%s possess %s"), *GetNameSafe(this), *GetNameSafe(NewCharacter));
Possess(NewCharacter);
//-------------------------------------------------------------------------------------------
// Replug the initial controller on the old character. For example, replug the initial
// AI controller of an AI when the player finishes controlling it. This needs to be done
// after the Possess call.
//-------------------------------------------------------------------------------------------
if (OldCharacter != nullptr && OldCharacter->InitialController != nullptr && OldCharacter->InitialController != this)
{
COG_LOG_OBJECT(LogCogPossession, ELogVerbosity::Verbose, this, TEXT("%s possess %s"), *GetNameSafe(OldCharacter->InitialController), *GetNameSafe(OldCharacter));
OldCharacter->InitialController->Possess(OldCharacter);
}
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSamplePlayerController::ResetControlledPawn()
{
ControlCharacter(InitialControlledCharacter.Get());
}
//--------------------------------------------------------------------------------------------------------------------------
@@ -46,13 +148,22 @@ void ACogSamplePlayerController::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
if (TargetAcquisition != nullptr)
{
TArray<AActor*> TagretToIgnore;
FCogSampleTargetAcquisitionResult Result;
TargetAcquisition->FindBestTarget(this, TagretToIgnore, nullptr, true, FVector2D::ZeroVector, false, Result);
SetTarget(Result.Target);
TickTargeting(DeltaSeconds);
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSamplePlayerController::TickTargeting(float DeltaSeconds)
{
if (TargetAcquisition == nullptr)
{
SetTarget(nullptr);
return;
}
TArray<AActor*> TagretToIgnore;
FCogSampleTargetAcquisitionResult Result;
TargetAcquisition->FindBestTarget(this, TagretToIgnore, nullptr, true, FVector2D::ZeroVector, false, Result);
SetTarget(Result.Target);
}
//--------------------------------------------------------------------------------------------------------------------------
+39 -6
View File
@@ -2,15 +2,17 @@
#include "CoreMinimal.h"
#include "AbilitySystemInterface.h"
#include "CogSampleDamageEvent.h"
#include "GameFramework/PlayerController.h"
#include "CogSamplePlayerController.generated.h"
class UCogSampleTargetAcquisition;
class ACogSampleCharacter;
//--------------------------------------------------------------------------------------------------------------------------
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FCogSampleTargetChangedEventDelegate, ACogSamplePlayerController*, Controller, AActor*, NewTarget, AActor*, OldTarget);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FCogSampleControlledCharacterChangedEventDelegate, ACogSamplePlayerController*, Controller, ACogSampleCharacter*, NewCharacter, ACogSampleCharacter*, OldCharacter);
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(config=Game)
class ACogSamplePlayerController : public APlayerController
@@ -23,22 +25,53 @@ public:
virtual void BeginPlay() override;
virtual void AcknowledgePossession(APawn* P);
virtual void Tick(float DeltaSeconds) override;
virtual void Tick(float DeltaSeconds);
//----------------------------------------------------------------------------------------------------------------------
// Control
//----------------------------------------------------------------------------------------------------------------------
virtual void OnPossess(APawn* NewPawn) override;
virtual void AcknowledgePossession(APawn* NewPawn) override;
UFUNCTION(BlueprintCallable)
void ControlCharacter(ACogSampleCharacter* NewCharacter);
UFUNCTION(BlueprintCallable)
void ResetControlledPawn();
UPROPERTY(BlueprintAssignable)
FCogSampleControlledCharacterChangedEventDelegate OnControlledCharacterChanged;
//----------------------------------------------------------------------------------------------------------------------
// Targeting
//----------------------------------------------------------------------------------------------------------------------
void SetTarget(AActor* Value);
AActor* GetTarget() const { return Target.Get(); }
UPROPERTY(BlueprintAssignable)
FCogSampleTargetChangedEventDelegate OnTargetChanged;
UPROPERTY(BlueprintAssignable)
FCogSampleDamageEventDelegate OnPawnDealtDamage;
private:
//----------------------------------------------------------------------------------------------------------------------
// Control
//----------------------------------------------------------------------------------------------------------------------
UPROPERTY(BlueprintReadonly, meta = (AllowPrivateAccess = "true"))
TWeakObjectPtr<ACogSampleCharacter> ControlledCharacter = nullptr;
UPROPERTY(BlueprintReadonly, meta = (AllowPrivateAccess = "true"))
TWeakObjectPtr<ACogSampleCharacter> InitialControlledCharacter = nullptr;
//----------------------------------------------------------------------------------------------------------------------
// Targeting
//----------------------------------------------------------------------------------------------------------------------
virtual void TickTargeting(float DeltaSeconds);
UFUNCTION(Reliable, Server)
void Server_SetTarget(AActor* Value);
+3 -3
View File
@@ -15,16 +15,16 @@ struct FCogSampleRootMotionParams
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
AActor* Instigator;
AActor* Instigator = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
AActor* Causer;
AActor* Causer = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<UGameplayEffect> Effect;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FRotator Rotation;
FRotator Rotation = FRotator::ZeroRotator;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool IsAdditive = false;