Space Plunder
Loading...
Searching...
No Matches
ACustomCharacterBase Class Reference

The base class for custom characters in the game. Inherits from various interfaces and provides implementations for the required functions. More...

#include <CustomCharacterBase.h>

Inheritance diagram for ACustomCharacterBase:
AALSCharacter ICharacterWeaponPickups ICharacterInterface IBaseInterface IBaseServer AALSBaseCharacter AInteractableCharacter IALSCharacterInterface ACharacterBase ICharacterBaseInterface ISaveLoad IBaseInterface ACustomAICharacter ACustomPlayerCharacter ACampaignAICharacter AHordeAICharacter ACampaignPlayerCharacter AMultiplayerPlayerCharacter

Public Member Functions

 ACustomCharacterBase (const FObjectInitializer &ObjectInitializer)
 
bool IsCrouching () const
 
virtual void NotifyHit (UPrimitiveComponent *MyComp, AActor *Other, UPrimitiveComponent *OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult &Hit) override
 
virtual ECharacterType GetCharacterType () const override
 
virtual EFactionType GetCharacterFaction () const override
 
virtual bool GetIsDead () const override
 
virtual void StartThreatIndication (AActor *PawnThreat) override
 
void OnStartThreatIndication (AActor *PawnThreat)
 
virtual void StopThreatIndication () override
 
void OnStopThreatIndication ()
 
virtual void UpdateThreatIndication (const FVector &Location, const float DetectionAmount) override
 
void OnUpdateThreatIndication (const FVector &Location, const float DetectionAmount)
 
virtual USkeletalMeshComponent * GetCharacterSecondaryMesh () const override
 
virtual void SetCharacterVehicleMode (const EVehicleMode Mode) override
 
virtual bool GetCharacterHealth (float &Health, float &MaxHealth) const override
 
void OnCharacterVehicleModeChanged (const EVehicleMode Mode)
 
virtual void ForceWakeUp ()
 
virtual void ReceiveStartFocus_Implementation (AActor *Caller) override
 
virtual void ReceiveEndFocus_Implementation (AActor *Caller) override
 
virtual void SetGravityEnabled (const bool bValue) override
 
virtual FString GetObjectDisplayName () const override
 
virtual void DestroyActor (AActor *ActorToDestroy) override
 
virtual void DestroyActorOnClient (AActor *ActorToDestroy) override
 
virtual bool GetIsCharacter () const override
 
void SetPlayerName (FString Username)
 
virtual int32 PickupGunEvent (const FWeaponData_T In_WeaponData) override
 
virtual bool PickupGunCheck (const FWeaponData_T &In_WeaponData) override
 
virtual bool PickupAttachmentCheck (const FWeaponAttachment &In_WeaponAttachmentData) override
 
virtual void PickupAttachmentEvent (const FString &WeaponAttachmentID) override
 
virtual void WeaponEquipped (const TArray< FWeaponData_T > &Weapons, const int32 CurrentWeaponIndex)
 
virtual void WeaponStateChanged (const struct FPlayerWeaponState &PlayerWeaponState)
 
virtual void ForwardMovementAction (float Value) override
 
virtual void RightMovementAction (float Value) override
 
virtual void RagdollStart () override
 
virtual void RagdollEnd () override
 
virtual void Landed (const FHitResult &Hit) override
 
virtual EALSGait GetAllowedGait () const override
 
virtual bool CanSprint () const override
 
virtual void SprintAction (bool bValue) override
 
virtual void JumpAction (bool bValue) override
 
virtual bool CanJumpInternal_Implementation () const override
 
virtual void StanceAction () override
 
virtual void OnJumped_Implementation () override
 
void FlyUp ()
 
void FlyDown ()
 
void Server_OnPawnSpawn ()
 
virtual void OnPawnSpawned () override
 
void ReceiveOnPawnSpawn ()
 
- Public Member Functions inherited from AALSCharacter
 AALSCharacter (const FObjectInitializer &ObjectInitializer)
 
void UpdateHeldObject ()
 
void ClearHeldObject ()
 
void AttachToHand (UStaticMesh *NewStaticMesh, USkeletalMesh *NewSkeletalMesh, class UClass *NewAnimClass, bool bLeftHand, FVector Offset)
 
virtual ECollisionChannel GetThirdPersonTraceParams (FVector &TraceOrigin, float &TraceRadius) override
 
virtual FTransform GetThirdPersonPivotTarget () override
 
virtual FVector GetFirstPersonCameraTarget () override
 
- Public Member Functions inherited from AALSBaseCharacter
 AALSBaseCharacter (const FObjectInitializer &ObjectInitializer)
 
FORCEINLINE class UALSCharacterMovementComponentGetALSMovementComponent () const
 
virtual FVector GetLeftHandGoal () const override
 
virtual FVector GetRightHandGoal () const override
 
virtual EALSOverlayState GetCurrentOverlayState () const override
 
virtual bool GetIsMantling () const override
 
virtual FORCEINLINE IALSGravityMovementInterfaceGetALSGravityMovementInterface () const override
 
virtual void Ragdoll () override
 
virtual void PostInitializeComponents () override
 
virtual void GetLifetimeReplicatedProps (TArray< FLifetimeProperty > &OutLifetimeProps) const override
 
UAnimMontage * GetGetUpAnimation (bool bRagdollFaceUpState)
 
void Server_SetMeshLocationDuringRagdoll (FVector MeshLocation)
 
void SetMovementState (EALSMovementState NewState, bool bForce=false)
 
EALSMovementState GetMovementState () const
 
EALSMovementState GetPrevMovementState () const
 
void SetMovementAction (EALSMovementAction NewAction, bool bForce=false)
 
EALSMovementAction GetMovementAction () const
 
void SetStance (EALSStance NewStance, bool bForce=false)
 
EALSStance GetStance () const
 
void SetOverlayOverrideState (int32 NewState)
 
int32 GetOverlayOverrideState () const
 
void SetGait (EALSGait NewGait, bool bForce=false)
 
EALSGait GetGait () const
 
EALSGait GetDesiredGait () const
 
virtual void SetRotationMode (EALSRotationMode NewRotationMode, bool bForce=false)
 
void Server_SetRotationMode (EALSRotationMode NewRotationMode, bool bForce)
 
EALSRotationMode GetRotationMode () const
 
virtual void SetViewMode (EALSViewMode NewViewMode, bool bForce=false)
 
void Server_SetViewMode (EALSViewMode NewViewMode, bool bForce)
 
EALSViewMode GetViewMode () const
 
void SetOverlayState (EALSOverlayState NewState, bool bForce=false)
 
void SetGroundedEntryState (EALSGroundedEntryState NewState)
 
void Server_SetOverlayState (EALSOverlayState NewState, bool bForce)
 
EALSOverlayState GetOverlayState () const
 
EALSGroundedEntryState GetGroundedEntryState () const
 
void EventOnLanded ()
 
void Multicast_OnLanded ()
 
void EventOnJumped ()
 
void Multicast_OnJumped ()
 
void Server_PlayMontage (UAnimMontage *Montage, float PlayRate)
 
void Multicast_PlayMontage (UAnimMontage *Montage, float PlayRate)
 
void Server_StopMontage (const float InBlendOutTime, const UAnimMontage *Montage)
 
void Multicast_StopMontage (const float InBlendOutTime, const UAnimMontage *Montage)
 
void ReplicatedRagdollStart ()
 
void Server_RagdollStart ()
 
void Multicast_RagdollStart ()
 
void ReplicatedRagdollEnd ()
 
void Server_RagdollEnd (FVector CharacterLocation)
 
void Multicast_RagdollEnd (FVector CharacterLocation)
 
EALSStance GetDesiredStance () const
 
void SetDesiredStance (EALSStance NewStance)
 
void Server_SetDesiredStance (EALSStance NewStance)
 
void SetDesiredGait (EALSGait NewGait)
 
void Server_SetDesiredGait (EALSGait NewGait)
 
EALSRotationMode GetDesiredRotationMode () const
 
virtual void SetDesiredRotationMode (EALSRotationMode NewRotMode)
 
void Server_SetDesiredRotationMode (EALSRotationMode NewRotMode)
 
void SetActorLocationAndTargetRotation (FVector NewLocation, FRotator NewRotation)
 
bool HasMovementInput () const
 
FALSMovementSettings GetTargetMovementSettings () const
 
EALSGait GetActualGait (EALSGait AllowedGait) const
 
void OnBreakfall ()
 
virtual void OnBreakfall_Implementation ()
 
virtual float PlayReplicatedMontage (UAnimMontage *MontageToPlay, const float InPlayRate, const EMontagePlayReturnType ReturnValueType, const float InTimeToStartMontageAt, const bool bStopAllMontages) override
 
virtual void StopReplicatedMontage (const float InBlendOutTime, const UAnimMontage *Montage) override
 
void Replicated_PlayMontage (UAnimMontage *Montage, float PlayRate)
 
virtual void Replicated_PlayMontage_Implementation (UAnimMontage *Montage, float PlayRate)
 
UAnimMontage * GetRollAnimation ()
 
float GetAnimCurveValue (FName CurveName) const
 
void SetVisibleMesh (USkeletalMesh *NewSkeletalMesh)
 
void Server_SetVisibleMesh (USkeletalMesh *NewSkeletalMesh)
 
bool IsRightShoulder () const
 
void SetRightShoulder (const bool bNewRightShoulder)
 
bool IsAimingDownSights () const
 
virtual bool GetCanAimDownSights () const
 
void SetAimDownSights (const bool bNewAimDownSights)
 
virtual FVector GetAimDownSightCameraTarget () const
 
virtual float GetAimDownSightFOV () const
 
void GetCameraParameters (float &TPFOVOut, float &FPFOVOut, bool &bRightShoulderOut) const
 
void SetCameraBehavior (UALSPlayerCameraBehavior *CamBeh)
 
FVector GetAcceleration () const
 
bool IsMoving () const
 
bool GetIsFlying () const
 
FVector GetMovementInput () const
 
float GetMovementInputAmount () const
 
float GetSpeed () const
 
FRotator GetAimingRotation () const
 
float GetAimYawRate () const
 
void CameraUpAction (float Value)
 
void CameraRightAction (float Value)
 
virtual void AimAction (bool bValue)
 
virtual void CameraTapAction ()
 
virtual void CameraHeldAction ()
 
void WalkAction ()
 
void RagdollAction ()
 
void VelocityDirectionAction ()
 
void LookingDirectionAction ()
 
- Public Member Functions inherited from AInteractableCharacter
 AInteractableCharacter (const FObjectInitializer &ObjectInitializer)
 
virtual USceneComponent * GetThrowPoint () const override
 
virtual void ReceiveStartFocus (AActor *Caller)
 
virtual void ReceiveEndFocus (AActor *Caller)
 
virtual void ReceiveOnInteract (AActor *Caller, const EInteractionType InteractionType)
 
virtual void ReceiveOnEndInteract (AActor *Caller)
 
virtual void ReceiveOnOverlap (AActor *Caller)
 
virtual void ReceiveOnEndOverlap (AActor *Caller)
 
virtual void ReceiveToggleSwitch (AActor *Caller, const bool bOn)
 
- Public Member Functions inherited from ACharacterBase
 ACharacterBase (const FObjectInitializer &ObjectInitializer)
 
virtual bool SaveGame () override
 
virtual bool LoadGame () override
 
virtual USkeletalMeshComponent * GetCharacterMesh () const override
 
virtual UPrimitiveComponent * GetPrimitiveComponent () override
 
virtual void RagdollStop () override
 
virtual FCharacterBaseSkillsGetCharacterSkills () override
 
virtual bool GetAudioSocketLocation (const FName &AudioSocket, FVector &Location) const override
 
virtual FCharacterInfo GetCharacterInfo () const override
 
virtual void GetThrowStats (FTransform &OutTransform, FVector &OutThrowForce) const override
 
virtual void CharacterModeChanged (const FGameplayTag &NewMode) override
 
virtual int32 GetStrength () const
 
virtual int32 GetPerception () const
 
virtual int32 GetEndurance () const
 
virtual int32 GetCharisma () const
 
virtual int32 GetIntelligence () const
 
virtual int32 GetAgility () const
 
virtual int32 GetWeaponSkill () const
 
virtual int32 GetStealth () const
 
virtual int32 GetLuck () const
 
virtual int32 GetSkillPoints () const
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void Tick (const float DeltaTime) override
 
virtual void SetupPlayerInputComponent (class UInputComponent *PlayerInputComponent) override
 
bool GetHandsTied () const
 
virtual void SetHandsTied (const bool bValue=true)
 
virtual void AimAssistOverlap (UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, const int32 OtherBodyIndex, const bool bFromSweep, const FHitResult &SweepResult)
 
void OnAimAssistOverlap (UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, const int32 OtherBodyIndex, const bool bFromSweep, const FHitResult &SweepResult)
 
virtual void AimAssistRevertSize ()
 
virtual void OnHealthAndShieldChanged (float Health, float MaxHealth, float ShieldHealth, float MaxShieldHealth, const class UDamageType *DamageType)
 
virtual void OnInjuredBodyPart (const EBodyPartName InjuredBodyPart, const FVector &HitLocation, const TArray< FBodyPart > &AllBodyParts)
 
virtual void OnShieldBreak ()
 
virtual void OnKnockedOut (const class UDamageType *DamageType, const float WaitTime)
 
virtual void OnWakeUp ()
 
virtual void OnDeath (AActor *OwningActor, const EDeathType DeathType, AActor *DeathCauser, AController *DeathInstigator)
 
virtual void OnFullDamageHit (AController *InstigatedBy, const float TotalDamage, const UDamageType *DamageType, const FName &HitBone, const FVector &HitLocation, const bool bKillingHit, const bool bInjuredPart)
 
FPlayerDeath GetPlayerDeathInfo (const EDeathType DeathType, AActor *DeathCauser, const AController *DeathInstigator) const
 
USkeletalMeshComponent * GetCustomMesh () const
 
virtual void OnDeathReplicated ()
 
virtual void FirePressedAction ()
 
virtual void SetupComponents (AController *ControllerReference=nullptr, AActor *HUDReference=nullptr, bool bIsLocallyControlled=false)
 
virtual void SaveGameData ()
 
virtual void LoadGameData ()
 
virtual bool SaveCharacterData ()
 
virtual bool LoadCharacterData ()
 
virtual void LoadComponentsSaveData ()
 
virtual void SaveComponentsData ()
 
virtual void UpdateStaminaHUD ()
 
virtual void Sprinting ()
 
virtual void StopSprinting ()
 
virtual void RechargeStamina ()
 
virtual void SetMaxStamina (const float AmountToAdd)
 
void OnCharacterReadyReplicated ()
 
- Protected Member Functions inherited from AALSCharacter
virtual void OnOverlayStateChanged (EALSOverlayState PreviousState) override
 
void UpdateHeldObjectAnimations ()
 
- Protected Member Functions inherited from AALSBaseCharacter
void RagdollUpdate (float DeltaTime)
 
void SetActorLocationDuringRagdoll (float DeltaTime)
 
virtual void OnMovementModeChanged (EMovementMode PrevMovementMode, uint8 PreviousCustomMode=0) override
 
virtual void OnMovementStateChanged (EALSMovementState PreviousState)
 
virtual void OnMovementActionChanged (EALSMovementAction PreviousAction)
 
virtual void OnStanceChanged (EALSStance PreviousStance)
 
virtual void OnRotationModeChanged (EALSRotationMode PreviousRotationMode)
 
virtual void OnGaitChanged (EALSGait PreviousGait)
 
virtual void OnViewModeChanged (EALSViewMode PreviousViewMode)
 
virtual void OnVisibleMeshChanged (const USkeletalMesh *PreviousSkeletalMesh)
 
virtual void OnStartCrouch (float HalfHeightAdjust, float ScaledHalfHeightAdjust) override
 
virtual void OnEndCrouch (float HalfHeightAdjust, float ScaledHalfHeightAdjust) override
 
void OnLandFrictionReset ()
 
void SetEssentialValues (float DeltaTime)
 
void UpdateCharacterMovement ()
 
void UpdateGroundedRotation (float DeltaTime)
 
void UpdateInAirRotation (float DeltaTime)
 
void SmoothCharacterRotation (FRotator Target, float TargetInterpSpeed, float ActorInterpSpeed, float DeltaTime)
 
float CalculateGroundedRotationRate () const
 
void LimitRotation (float AimYawMin, float AimYawMax, float InterpSpeed, float DeltaTime)
 
void SetMovementModel ()
 
void ForceUpdateCharacterState ()
 
void OnRep_RotationMode (EALSRotationMode PrevRotMode)
 
void OnRep_ViewMode (EALSViewMode PrevViewMode)
 
void OnRep_OverlayState (EALSOverlayState PrevOverlayState)
 
void OnRep_VisibleMesh (const USkeletalMesh *PreviousSkeletalMesh)
 
void HandleNonMovingRotation (float DeltaTime)
 
- Protected Member Functions inherited from AInteractableCharacter
virtual void InteractionDataUpdated ()
 
- Protected Member Functions inherited from ACharacterBase
virtual void FallOver (const float WaitTime)
 
void OnFallOver (const float WaitTime)
 
virtual void GetUpFromFall ()
 
void OnGetUpFromFall ()
 
void OnRep_CharacterDeath ()
 
IPlayerControllerInterfaceGetPlayerControllerInterface ()
 
IPlayerStateInterfaceGetPlayerStateInterface ()
 
void LogDebugError (const FString &Message) const
 
void LogDebugError (const FString &Message, const int32 Value) const
 
void LogDebugError (const FString &Message, const float Value) const
 
void LogDebugWarning (const FString &Message) const
 
void LogDebugWarning (const FString &Message, const int32 Value) const
 
void LogDebugWarning (const FString &Message, const float Value) const
 
void LogDebugMessage (const FString &Message, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const int32 Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const float Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const bool bValue, const bool bWarning, const bool bError) const
 
void LogOnScreenMessage (const int32 Key, const FString &Message, FColor Color=FColor::Green) const
 
void SetCategoryName (const FLogCategoryBase &Category)
 

Protected Attributes

class UCharacterHealthComponent * CharacterHealthComponent
 
class UHealthBarWidgetComponent * HealthBarComponent
 
class UPhysicalAnimationComponent * PhysicalAnimationComponent
 
class UPhysicalHitReactionsComponentPhysicalHitReactionComponent
 
class UMeleeComponent * MeleeComponent
 
class UFootstepFXHandler * FootstepsComponent
 
class USphereComponent * AimAssistSphereComponent
 Remove? use sphere trace instead //.
 
class URecoilAnimationComponent * RecoilAnimationComponent
 
class UALSMantleComponentMantleComponentReference
 
USkeletalMeshComponent * CustomSkeletalMesh
 
float MultiplayerStartDelay = 0.5f
 
float FallDamageOffset = 550.0f
 
float FallDamageDivisor = 5.0f
 
ECharacterType CharacterType = ECharacterType::Human
 
FString DisplayName = "Default Name"
 
bool bForceWalkWhileAiming = true
 
bool bToggleSprint = true
 
bool bSprinting = true
 
float SprintDeadZone = 0.5f
 
float FlyingScaleValue = 1.0f
 
bool bIsFlyingUp = false
 
bool bIsFlyingDown = false
 
float Stamina = 100.0f
 
float MinRequiredStamina = 0.2f
 
float MaxStamina = 60.0f
 
float MaxStaminaDefault = 60.0f
 
float MaxPossibleStamina = 150.0f
 
float MinStamina = 10.0f
 
float StaminaDepletionRate = 0.05f
 
float StaminaDepletionIncrement = 0.5f
 
float StaminaRechargeRate = 0.05f
 
float StaminaRechargeIncrement = 0.5f
 
float StaminaRechargeDelayTime = 2.0f
 
float StaminaJumpAmount = 10.0f
 
float ThrowStrength = 500.0f
 
bool bHandsTied = false
 
float AimAssistRadius = 160.0f
 
float AimAssistShrinkTime = 3.0f
 
bool bIsNPC = false
 
bool bIsDead = false
 
bool bCharacterReady = false
 
- Protected Attributes inherited from AALSCharacter
TObjectPtr< USceneComponent > HeldObjectRoot = nullptr
 
TObjectPtr< USkeletalMeshComponent > SkeletalMesh = nullptr
 
TObjectPtr< UStaticMeshComponent > StaticMesh = nullptr
 
- Protected Attributes inherited from AALSBaseCharacter
TObjectPtr< UALSCharacterMovementComponentMyCharacterMovementComponent
 
bool bOptimizeGroundRotation = true
 
bool bOptimizeAnimValues = true
 
FALSAnimValues AnimValues
 
IALSAnimInterfaceAnimInstanceInterface
 
EALSRotationMode DesiredRotationMode = EALSRotationMode::LookingDirection
 
EALSGait DesiredGait = EALSGait::Running
 
EALSStance DesiredStance = EALSStance::Standing
 
float LookUpDownRate = 1.25f
 
float LookLeftRightRate = 1.25f
 
float RollDoubleTapTimeout = 0.3f
 
bool bBreakFall = false
 
bool bSprintHeld = false
 
float ThirdPersonFOV = 90.0f
 
float FirstPersonFOV = 90.0f
 
bool bRightShoulder = false
 
bool bAimDownSights = false
 
FDataTableRowHandle MovementModel
 
FVector Acceleration = FVector::ZeroVector
 
bool bIsMoving = false
 
bool bIsFlying = false
 
bool bHasMovementInput = false
 
FRotator LastVelocityRotation
 
FRotator LastMovementInputRotation
 
float Speed = 0.0f
 
float MovementInputAmount = 0.0f
 
float AimYawRate = 0.0f
 
float EasedMaxAcceleration = 0.0f
 
FVector ReplicatedCurrentAcceleration = FVector::ZeroVector
 
FRotator ReplicatedControlRotation = FRotator::ZeroRotator
 
TObjectPtr< USkeletalMesh > VisibleMesh = nullptr
 
EALSOverlayState OverlayState = EALSOverlayState::Default
 
EALSGroundedEntryState GroundedEntryState
 
EALSMovementState MovementState = EALSMovementState::None
 
EALSMovementState PrevMovementState = EALSMovementState::None
 
EALSMovementAction MovementAction = EALSMovementAction::None
 
EALSRotationMode RotationMode = EALSRotationMode::LookingDirection
 
EALSGait Gait = EALSGait::Walking
 
EALSStance Stance = EALSStance::Standing
 
EALSViewMode ViewMode = EALSViewMode::ThirdPerson
 
int32 OverlayOverrideState = 0
 
FALSMovementStateSettings MovementData
 
FRotator TargetRotation = FRotator::ZeroRotator
 
FRotator InAirRotation = FRotator::ZeroRotator
 
float YawOffset = 0.0f
 
bool bBreakfallOnLand = true
 
float BreakfallOnLandVelocity = 700.0f
 
bool bReversedPelvis = false
 
bool bRagdollOnLand = false
 
float RagdollOnLandVelocity = 1000.0f
 
bool bRagdollOnGround = false
 
bool bRagdollFaceUp = false
 
FVector LastRagdollVelocity = FVector::ZeroVector
 
FVector TargetRagdollLocation = FVector::ZeroVector
 
float ServerRagdollPull = 0.0f
 
EVisibilityBasedAnimTickOption DefVisBasedTickOp
 
bool bPreRagdollURO = false
 
FVector PreviousVelocity = FVector::ZeroVector
 
float PreviousAimYaw = 0.0f
 
TObjectPtr< UALSPlayerCameraBehaviorCameraBehavior
 
float LastStanceInputTime = 0.0f
 
FTimerHandle OnLandedFrictionResetTimer
 
FRotator AimingRotation = FRotator::ZeroRotator
 
bool bEnableNetworkOptimizations = false
 
bool bForceEnableNetworkOptimizationsOff = false
 
- Protected Attributes inherited from AInteractableCharacter
USceneComponent * ThrowPoint
 
class UInteractionComponent * InteractionComponent
 
class UInteractableActorComponent * InteractableActorComponent
 
class USphereComponent * InteractionSphere
 
class UInventoryComponent * InventoryComponent
 
class UAudioReactionComponent * AudioReactionComponent
 
bool bAlwaysShowOutline = false
 
- Protected Attributes inherited from ACharacterBase
bool bDebuggingMode = false
 
FCharacterBaseSkills CharacterSkills
 
FCharacterInfo CharacterInfo
 
bool bDead = false
 
float PickupThrowIntensity = 500.0f
 
bool bCanBePushed = false
 
float HitVelocityThreshold = 50.0f
 
float HitVelocityMultiplier = 5.0f
 
float HitReactionMultiplier = 0.01f
 
bool bPushHitReaction = true
 
bool bAddMovementInput = true
 
bool bAddCharacterMovement = true
 
float PushFallVelocityThreshold = 200.0f
 
float PushedFallVelocityThreshold = 500.0f
 
float PushedFallOverWaitTime = 2.0f
 

Private Attributes

FTimerHandle StaminaTimerHandle
 
FTimerHandle StaminaRechargeTimerHandle
 
FTimerHandle FallOverTimerHandle
 
FTimerHandle FlyingTimerHandle
 
FTimerHandle AimAssistOverlapTimerHandle
 

Additional Inherited Members

- Public Attributes inherited from AALSBaseCharacter
float GravityMultiplier = 9.8f
 
FJumpPressedSignature JumpPressedDelegate
 
FOnJumpedSignature OnJumpedDelegate
 
FRagdollStateChangedSignature RagdollStateChangedDelegate
 
- Public Attributes inherited from ACharacterBase
FOnCharacterDeath OnCharacterDeath
 

Detailed Description

The base class for custom characters in the game. Inherits from various interfaces and provides implementations for the required functions.

Constructor & Destructor Documentation

◆ ACustomCharacterBase()

ACustomCharacterBase::ACustomCharacterBase ( const FObjectInitializer & ObjectInitializer)
41 : AALSCharacter(ObjectInitializer
42 .DoNotCreateDefaultSubobject(TEXT("HeldObjectRoot"))
43 .DoNotCreateDefaultSubobject(TEXT("StaticMesh"))
44 .DoNotCreateDefaultSubobject(TEXT("SkeletalMesh")))
45{
46 PrimaryActorTick.bCanEverTick = true;
47 if(GetCapsuleComponent() != nullptr)
48 {
49 GetCapsuleComponent()->SetCollisionProfileName(FName("ALS_Character"));
50 }
51
52 //- Custom Skeleton //
53 CustomSkeletalMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Custom Skeletal Mesh"));
54 CustomSkeletalMesh->SetupAttachment(GetMesh());
55 CustomSkeletalMesh->SetNotifyRigidBodyCollision(true);
56 CustomSkeletalMesh->BodyInstance.bNotifyRigidBodyCollision = true;
57 CustomSkeletalMesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
58 CustomSkeletalMesh->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore);
59 CustomSkeletalMesh->SetCollisionResponseToChannel(ECC_GameTraceChannel3, ECR_Ignore); // Climable
60 CustomSkeletalMesh->SetGenerateOverlapEvents(true);
61
62 //- Hide Regular Mesh //
63 // SkeletalMesh->SetHiddenInGame(true);
64 if(GetMesh() != nullptr)
65 {
66 GetMesh()->SetVisibleFlag(false);
67 GetMesh()->bHiddenInGame = true;
68
69 //- Hit Events/Collision //
70 GetMesh()->BodyInstance.bNotifyRigidBodyCollision = true; //- Generate Hit Events //
71 GetMesh()->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
72 GetMesh()->bUpdateJointsFromAnimation = true;
73 GetMesh()->bEnableUpdateRateOptimizations = false;
74
75 GetMesh()->SetCollisionProfileName(FName("ALS_Mesh"));
76 }
77
78 // GetCapsuleComponent()->BodyInstance.bNotifyRigidBodyCollision = true;
79
80 //- Throw Point //
81 ThrowPoint = CreateDefaultSubobject<USceneComponent>(TEXT("ThrowPoint"));
82 ThrowPoint->SetupAttachment(CustomSkeletalMesh, ("head"));
83 ThrowPoint->SetWorldTransform(FTransform(FRotator(90.0f,-90.0f,0.0f), FVector(0.0f,-30.0f,80.0f)));
84
85 //- Health //
86 CharacterHealthComponent = CreateDefaultSubobject<UCharacterHealthComponent>(TEXT("Character Health"));
87 CharacterHealthComponent->OnHealthAndShieldChanged.AddUniqueDynamic(this, &ACustomCharacterBase::OnHealthAndShieldChanged);
88 CharacterHealthComponent->OnInjuredBodyPart.AddUniqueDynamic(this, &ACustomCharacterBase::OnInjuredBodyPart);
89 CharacterHealthComponent->OnShieldBreak.AddUniqueDynamic(this, &ACustomCharacterBase::OnShieldBreak);
90 CharacterHealthComponent->OnNonLethalKnockOut.AddUniqueDynamic(this, &ACustomCharacterBase::OnKnockedOut);
91 CharacterHealthComponent->OnWakeUp.AddUniqueDynamic(this, &ACustomCharacterBase::OnWakeUp);
92 CharacterHealthComponent->OnDeath.AddUniqueDynamic(this, &ACustomCharacterBase::OnDeath);
93 CharacterHealthComponent->OnDamageHit.AddUniqueDynamic(this, &ACustomCharacterBase::OnFullDamageHit);
94
95 HealthBarComponent = CreateDefaultSubobject<UHealthBarWidgetComponent>(TEXT("Health Bar"));
96 HealthBarComponent->SetupAttachment(GetMesh());
97 HealthBarComponent->SetRelativeScale3D(FVector(0.3f));
98 HealthBarComponent->SetRelativeLocation(FVector(0.0f,0.0f,195.0f));
99 HealthBarComponent->SetRelativeRotation(FRotator(0.0f, 90.0f, 0.0f));
100 HealthBarComponent->SetCollapsed(true);
101 HealthBarComponent->SetHasShield(CharacterHealthComponent->bHasShield);
102
103 //- Recoil Animation - Optional //
104 RecoilAnimationComponent = CreateOptionalDefaultSubobject<URecoilAnimationComponent>(TEXT("Recoil Animation"));
105
106 //- Interaction //
107 InteractionComponent = CreateDefaultSubobject<UInteractionComponent>("Interaction");
108 //- Set for outlines //
109 GetMesh()->bRenderCustomDepth = false;
110 CustomSkeletalMesh->bRenderCustomDepth = false;
111
112 //- Physical Animation //
113 PhysicalAnimationComponent = CreateOptionalDefaultSubobject<UPhysicalAnimationComponent>(TEXT("Physical Anim"));
114 PhysicalAnimationComponent->SetIsReplicated(true);
115 PhysicalHitReactionComponent = CreateOptionalDefaultSubobject<UPhysicalHitReactionsComponent>("Physical Hit Reactions");
116
117 AimAssistSphereComponent = CreateDefaultSubobject<USphereComponent>("Aim Assist Component");
119 AimAssistSphereComponent->InitSphereRadius(AimAssistRadius);
120 AimAssistSphereComponent->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
121 AimAssistSphereComponent->SetCollisionProfileName(FName("AimAssist"));
122 AimAssistSphereComponent->SetWorldLocation(FVector(0.0f,0.0f,110.0f));
123 AimAssistSphereComponent->OnComponentBeginOverlap.AddUniqueDynamic(this, &ACustomCharacterBase::AimAssistOverlap);
124
125
126 AudioReactionComponent = CreateDefaultSubobject<UAudioReactionComponent>(TEXT("Audio Reaction"));
127
128 MeleeComponent = CreateDefaultSubobject<UMeleeComponent>(TEXT("Melee"));
129
130 FootstepsComponent = CreateDefaultSubobject<UFootstepFXHandler>(TEXT("Footstep Component"));
131
134 //- Defaults for some of the ALS character - from the BP
135 bRightShoulder = true;
136 bRagdollOnLand = true;
137
138 InteractableActorComponent->AimAssistInfluence = 1.0f;
139 InteractableActorComponent->InteractionData.InteractionTypes.Add(FInteractionType(EInteractionType::Untie, true));
140 InteractableActorComponent->InteractionData.InteractionTypes.Add(FInteractionType(EInteractionType::Tie, true));
141}
bool bRagdollOnLand
Definition ALSBaseCharacter.h:655
bool bRightShoulder
Definition ALSBaseCharacter.h:534
AALSCharacter(const FObjectInitializer &ObjectInitializer)
Definition ALSCharacter.cpp:11
USkeletalMeshComponent * CustomSkeletalMesh
Definition CustomCharacterBase.h:222
class URecoilAnimationComponent * RecoilAnimationComponent
Definition CustomCharacterBase.h:214
class UMeleeComponent * MeleeComponent
Definition CustomCharacterBase.h:204
virtual void OnWakeUp()
Definition CustomCharacterBase.cpp:1255
float MaxStaminaDefault
Definition CustomCharacterBase.h:280
virtual void AimAssistOverlap(UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, const int32 OtherBodyIndex, const bool bFromSweep, const FHitResult &SweepResult)
Definition CustomCharacterBase.cpp:172
class UHealthBarWidgetComponent * HealthBarComponent
Definition CustomCharacterBase.h:192
virtual void OnInjuredBodyPart(const EBodyPartName InjuredBodyPart, const FVector &HitLocation, const TArray< FBodyPart > &AllBodyParts)
Definition CustomCharacterBase.cpp:1197
virtual void OnKnockedOut(const class UDamageType *DamageType, const float WaitTime)
Definition CustomCharacterBase.cpp:1247
class UPhysicalHitReactionsComponent * PhysicalHitReactionComponent
Definition CustomCharacterBase.h:202
virtual void OnFullDamageHit(AController *InstigatedBy, const float TotalDamage, const UDamageType *DamageType, const FName &HitBone, const FVector &HitLocation, const bool bKillingHit, const bool bInjuredPart)
Definition CustomCharacterBase.cpp:1181
float Stamina
Definition CustomCharacterBase.h:274
virtual void OnHealthAndShieldChanged(float Health, float MaxHealth, float ShieldHealth, float MaxShieldHealth, const class UDamageType *DamageType)
Definition CustomCharacterBase.cpp:1175
virtual void OnDeath(AActor *OwningActor, const EDeathType DeathType, AActor *DeathCauser, AController *DeathInstigator)
Definition CustomCharacterBase.cpp:1263
class UFootstepFXHandler * FootstepsComponent
Definition CustomCharacterBase.h:206
float MaxStamina
Definition CustomCharacterBase.h:279
class UPhysicalAnimationComponent * PhysicalAnimationComponent
Definition CustomCharacterBase.h:196
virtual void OnShieldBreak()
Definition CustomCharacterBase.cpp:1239
class USphereComponent * AimAssistSphereComponent
Remove? use sphere trace instead //.
Definition CustomCharacterBase.h:210
float AimAssistRadius
Definition CustomCharacterBase.h:336
class UCharacterHealthComponent * CharacterHealthComponent
Definition CustomCharacterBase.h:190
class UAudioReactionComponent * AudioReactionComponent
Definition InteractableCharacter.h:65
class UInteractableActorComponent * InteractableActorComponent
Definition InteractableCharacter.h:58
class UInteractionComponent * InteractionComponent
Definition InteractableCharacter.h:56
USceneComponent * ThrowPoint
Definition InteractableCharacter.h:54
Definition BaseData.h:333

Member Function Documentation

◆ AimAssistOverlap()

void ACustomCharacterBase::AimAssistOverlap ( UPrimitiveComponent * OverlappedComponent,
AActor * OtherActor,
UPrimitiveComponent * OtherComp,
const int32 OtherBodyIndex,
const bool bFromSweep,
const FHitResult & SweepResult )
protectedvirtual
174{
175 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::AimAssistOverlap);
176 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
177
178 OnAimAssistOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
179 if(OtherActor == nullptr || AimAssistSphereComponent == nullptr){UBaseHelpersBPLib::PrintToLog(this, "Aim Assist component or OtherActor Null in AimAssistOverlap");return;}
180 const IBaseInterface* BaseActor = Cast<IBaseInterface>(OtherActor);
181 if(BaseActor == nullptr){return;}
182 if(BaseActor->GetIsCharacter() && AimAssistSphereComponent != nullptr)
183 {
184 //@BUG When Making the Radius smaller, it doesn't trigger end overlap on the OtherActor //
185 //? Temp remove to see if this is the cause of the Context getting stuck on screen
186 // AimAssistComponent->SetSphereRadius(0.0f);
187 // GetWorld()->GetTimerManager().SetTimer(AimAssistOverlapTimerHandle, this, &ACustomCharacterBase::AimAssistRevertSize, AimAssistShrinkTime);
188 // OtherActor->NotifyActorEndOverlap(this);
189 }
190}
void OnAimAssistOverlap(UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, const int32 OtherBodyIndex, const bool bFromSweep, const FHitResult &SweepResult)
Definition BaseInterface.h:17
static void PrintToLog(const UObject *WorldContextObject, const FString &Message, const bool bWarning=false, const bool bError=false)
Definition BaseHelpersBPLib.cpp:98

◆ AimAssistRevertSize()

void ACustomCharacterBase::AimAssistRevertSize ( )
protectedvirtual
193{
194 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::AimAssistRevertSize);
195 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
196
197 GetWorld()->GetTimerManager().ClearTimer(AimAssistOverlapTimerHandle);
198 if(AimAssistSphereComponent != nullptr)
199 {
201 }
202}
FTimerHandle AimAssistOverlapTimerHandle
Definition CustomCharacterBase.h:457
virtual void AimAssistRevertSize()
Definition CustomCharacterBase.cpp:192

◆ BeginPlay()

void ACustomCharacterBase::BeginPlay ( )
overrideprotectedvirtual

Reimplemented from AALSCharacter.

Reimplemented in ACampaignAICharacter, ACampaignPlayerCharacter, ACustomAICharacter, ACustomPlayerCharacter, and AMultiplayerPlayerCharacter.

145{
146 Super::BeginPlay();
147 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::BeginPlay);
148 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
149 if(CharacterHealthComponent != nullptr && HealthBarComponent != nullptr)
150 {
151 CharacterHealthComponent->OnHealthAndShieldChanged.AddDynamic(HealthBarComponent, &UHealthBarWidgetComponent::UpdateHeathAndShield);
152 HealthBarComponent->SetHasShield(CharacterHealthComponent->bHasShield);
153 CharacterHealthComponent->UpdateShieldAndHealth();
154 }
155}
virtual void BeginPlay() override
Definition CustomCharacterBase.cpp:144

◆ CanJumpInternal_Implementation()

bool ACustomCharacterBase::CanJumpInternal_Implementation ( ) const
overridevirtual

Reimplemented in ACustomPlayerCharacter.

964{
965 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
967 {
968 // UBaseHelpersBPLib::PrintToLog(this, FString("Stamina: Can Jump ") + FString::SanitizeFloat(Stamina), true);
969 return Super::CanJumpInternal_Implementation();
970 }
971 return false;
972}
float StaminaJumpAmount
Definition CustomCharacterBase.h:299

◆ CanSprint()

bool ACustomCharacterBase::CanSprint ( ) const
overridevirtual

Reimplemented from AALSBaseCharacter.

Reimplemented in ACustomAICharacter.

975{
976 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
977 if(Stamina >= 0.0f || bIsNPC)
978 {
979 return Super::CanSprint();
980 }
981 return false;
982}
bool bIsNPC
Definition CustomCharacterBase.h:383

◆ DestroyActor()

virtual void ACustomCharacterBase::DestroyActor ( AActor * ActorToDestroy)
overridevirtual

Reimplemented from IBaseServer.

◆ DestroyActorOnClient()

virtual void ACustomCharacterBase::DestroyActorOnClient ( AActor * ActorToDestroy)
overridevirtual

Reimplemented from IBaseServer.

◆ FirePressedAction()

void ACustomCharacterBase::FirePressedAction ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

503{
504 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
505 //@ TODO dead off?
506 // if(GetIsDead()){return;}
507 // if(RotationMode == EALSRotationMode::VelocityDirection)
508 // {
509 // // UE_LOG(LogTemp,Warning,TEXT("ACustomCharacterBase::FirePressedAction_Implementation SetRotationMode"));
510 // SetRotationMode(EALSRotationMode::LookingDirection);
511 // }
512 //@TODO temp off
513 // if(MantleComponentReference != nullptr)
514 // {
515 // UE_LOG(LogTemp,Warning,TEXT("ACustomCharacterBase::FirePressedAction_Implementation MantleComponentReference"));
516 // if(MantleComponentReference->IsMantlePlaying()){return;}
517 // }
518 // if(GetOverlayState() != EALSOverlayState::Melee)
519 // {
520 // UE_LOG(LogTemp,Warning,TEXT("ACustomCharacterBase::FirePressedAction_Implementation SetOverlayState"));
521 // SetOverlayState(EALSOverlayState::Melee);
522 // }
523 // if(MeleeComponent != nullptr)
524 // {
525 // UE_LOG(LogTemp,Warning,TEXT("ACustomCharacterBase::FirePressedAction_Implementation MeleeAttack"));
526 // MeleeComponent->MeleeAttack();
527 // }
528}

◆ FlyDown()

void ACustomCharacterBase::FlyDown ( )
945{
946 AddMovementInput(GetActorUpVector(), -FlyingScaleValue);
947}
float FlyingScaleValue
Definition CustomCharacterBase.h:267

◆ FlyUp()

void ACustomCharacterBase::FlyUp ( )
939{
940 UE_LOG(LogTemp, Warning, TEXT(" "))
941 AddMovementInput(GetActorUpVector(), FlyingScaleValue);
942}

◆ ForceWakeUp()

void ACustomCharacterBase::ForceWakeUp ( )
virtual
580{
581 if(CharacterHealthComponent != nullptr)
582 {
583 CharacterHealthComponent->ForceWakeUp();
584 }
585}

◆ ForwardMovementAction()

void ACustomCharacterBase::ForwardMovementAction ( float Value)
overridevirtual

Input

Reimplemented from AALSBaseCharacter.

790{
791 Super::ForwardMovementAction(Value);
792 if(bSprinting && (Value <= SprintDeadZone && Value >= -SprintDeadZone))
793 {
795 }
796 // if((Value > SprintDeadZone || Value < -SprintDeadZone))
797 // {
798 // b
799 // }
800}
float SprintDeadZone
Definition CustomCharacterBase.h:264
virtual void StopSprinting()
Definition CustomCharacterBase.cpp:1064
bool bSprinting
Definition CustomCharacterBase.h:261

◆ GetAllowedGait()

EALSGait ACustomCharacterBase::GetAllowedGait ( ) const
overridevirtual

Reimplemented from AALSBaseCharacter.

Reimplemented in ACustomPlayerCharacter, and AMultiplayerPlayerCharacter.

882{
883 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
884 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::GetAllowedGait);
885
886 // Calculate the Allowed Gait. This represents the maximum Gait the character is currently allowed to be in,
887 // and can be determined by the desired gait, the rotation mode, the stance, etc. For example,
888 // if you wanted to force the character into a walking state while indoors, this could be done here.
889 //- without this can now crouch run
890 // if (Stance == EALSStance::Standing)
891 // {
893 {
895 {
897 }
898 return DesiredGait;
899 }
900 // }
901 //? Only Walk while aiming //
903 {
905 {
906 return EALSGait::Walking;
907 }
908 }
909 // Crouching stance & Aiming rot mode has same behaviour
910
912 {
913 return EALSGait::Running;
914 }
915 return DesiredGait;
916}
EALSGait DesiredGait
Definition ALSBaseCharacter.h:505
EALSRotationMode RotationMode
Definition ALSBaseCharacter.h:607
virtual bool CanSprint() const override
Definition CustomCharacterBase.cpp:974
bool bForceWalkWhileAiming
Definition CustomCharacterBase.h:252
virtual EALSGait GetAllowedGait() const override
Definition CustomCharacterBase.cpp:881

◆ GetCharacterFaction()

EFactionType ACustomCharacterBase::GetCharacterFaction ( ) const
overridevirtual

Implements ICharacterInterface.

Reimplemented in ACustomAICharacter.

543{
544 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
546}

◆ GetCharacterHealth()

bool ACustomCharacterBase::GetCharacterHealth ( float & Health,
float & MaxHealth ) const
overridevirtual

Return if Success

Reimplemented from ACharacterBase.

572{
573 if(CharacterHealthComponent == nullptr){return false;}
574 Health = CharacterHealthComponent->GetHealth();
575 MaxHealth = CharacterHealthComponent->GetMaxHealth();
576 return true;
577}
Definition Health.Build.cs:6

◆ GetCharacterSecondaryMesh()

virtual USkeletalMeshComponent * ACustomCharacterBase::GetCharacterSecondaryMesh ( ) const
inlineoverridevirtual

Reimplemented from ICharacterInterface.

70{return GetCustomMesh();};
USkeletalMeshComponent * GetCustomMesh() const
Definition CustomCharacterBase.h:381

◆ GetCharacterType()

ECharacterType ACustomCharacterBase::GetCharacterType ( ) const
overridevirtual

Implements ICharacterInterface.

537{
538 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
539 return CharacterType;
540}
ECharacterType CharacterType
Definition CustomCharacterBase.h:246

◆ GetCustomMesh()

USkeletalMeshComponent * ACustomCharacterBase::GetCustomMesh ( ) const
inlineprotected
381{return CustomSkeletalMesh;}

◆ GetHandsTied()

bool ACustomCharacterBase::GetHandsTied ( ) const
inlineprotected
329{return bHandsTied;}
bool bHandsTied
Definition CustomCharacterBase.h:333

◆ GetIsCharacter()

virtual bool ACustomCharacterBase::GetIsCharacter ( ) const
inlineoverridevirtual
125{return true;};

◆ GetIsDead()

virtual bool ACustomCharacterBase::GetIsDead ( ) const
inlineoverridevirtual

Implements ICharacterInterface.

54{return bIsDead;};
bool bIsDead
Definition CustomCharacterBase.h:385

◆ GetObjectDisplayName()

virtual FString ACustomCharacterBase::GetObjectDisplayName ( ) const
inlineoverridevirtual
119{return DisplayName;};
FString DisplayName
Definition CustomCharacterBase.h:248

◆ GetPlayerDeathInfo()

FPlayerDeath ACustomCharacterBase::GetPlayerDeathInfo ( const EDeathType DeathType,
AActor * DeathCauser,
const AController * DeathInstigator ) const
protected
1447{
1448 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1449 FPlayerDeath PlayerDeath;
1450 PlayerDeath.CauseOfDeath = DeathType;
1451 const IBaseInterface* AttackerWeapon = Cast<IBaseInterface>(DeathCauser);
1452 if(AttackerWeapon != nullptr)
1453 {
1454 PlayerDeath.WeaponID = AttackerWeapon->GetObjectDisplayName();
1455 }
1456 if(bIsNPC)
1457 {
1458 PlayerDeath.VictimTeamID = MAX_int32;
1459 PlayerDeath.Victim = GetObjectDisplayName();
1460 PlayerDeath.bAIVictim = true;
1461 const IGenericTeamAgentInterface* OwnerController = Cast<IGenericTeamAgentInterface>(GetController());
1462 if(OwnerController != nullptr)
1463 {
1464 PlayerDeath.VictimTeamID = OwnerController->GetGenericTeamId().GetId();
1465 }
1466 }
1467 if(DeathInstigator != nullptr)
1468 {
1469 PlayerDeath.AttackerActor = DeathInstigator->GetPawn();
1470 PlayerDeath.bAIAttacker = !DeathInstigator->IsPlayerController();
1471 const IGenericTeamAgentInterface* AttackerController = Cast<IGenericTeamAgentInterface>(DeathInstigator);
1472 if(AttackerController != nullptr)
1473 {
1474 PlayerDeath.AttackerTeamID = AttackerController->GetGenericTeamId().GetId();
1475 }
1476
1477
1478 // const IGenericTeamAgentInterface* AttackerController = Cast<IGenericTeamAgentInterface>(DeathInstigator->GetPlayerState<APlayerState>());
1479 // if(AttackerController != nullptr)
1480 // {
1481 // PlayerDeath.AttackerTeamID = AttackerController->GetGenericTeamId().GetId();
1482 // }
1483 // ACustomPlayerState* CustomAttackerPlayerState = Cast<ACustomPlayerState>(DeathInstigator->GetPlayerState<APlayerState>());
1484 // if(CustomAttackerPlayerState != nullptr)
1485 // {
1486 // PlayerDeath.AttackerPlayerState = CustomAttackerPlayerState;
1487 // }
1488 }
1489
1490 // const IGenericTeamAgentInterface* VictimController = Cast<IGenericTeamAgentInterface>(GetPlayerState());
1491 // if(VictimController != nullptr)
1492 // {
1493 // PlayerDeath.VictimTeamID = VictimController->GetGenericTeamId().GetId();
1494 // }
1495 if(PlayerDeath.AttackerTeamID == PlayerDeath.VictimTeamID)
1496 {
1497 PlayerDeath.bTeamKill = true;
1498 }
1499 if(bDebuggingMode){UE_LOG(LogTemp, Warning, TEXT("Victim ID: %i, Attacker ID: %i"), PlayerDeath.VictimTeamID, PlayerDeath.AttackerTeamID);}
1500
1501 ACustomPlayerState* CustomVictimPlayerState = Cast<ACustomPlayerState>(GetPlayerState());
1502 if(CustomVictimPlayerState != nullptr)
1503 {
1504 PlayerDeath.VictimPlayerState = CustomVictimPlayerState;
1505 }
1506 if(PlayerDeath.AttackerPlayerState == PlayerDeath.VictimPlayerState)
1507 {
1508 PlayerDeath.bSelfDeath = true;
1509 }
1510 return PlayerDeath;
1511}
bool bDebuggingMode
Definition CharacterBase.h:145
virtual FString GetObjectDisplayName() const override
Definition CustomCharacterBase.h:119
Definition CustomPlayerState.h:16
Definition BaseData.h:613
class APlayerState * VictimPlayerState
Definition BaseData.h:628
bool bAIVictim
Definition BaseData.h:643
FString Victim
Definition BaseData.h:619
EDeathType CauseOfDeath
Definition BaseData.h:636
bool bSelfDeath
Definition BaseData.h:646
int32 AttackerTeamID
Definition BaseData.h:631
class APlayerState * AttackerPlayerState
Definition BaseData.h:626
bool bTeamKill
Definition BaseData.h:648
AActor * AttackerActor
Definition BaseData.h:621
int32 VictimTeamID
Definition BaseData.h:633
bool bAIAttacker
Definition BaseData.h:641
FString WeaponID
Definition BaseData.h:638

◆ IsCrouching()

bool ACustomCharacterBase::IsCrouching ( ) const
inline
43{return Stance == EALSStance::Crouching;};
EALSStance Stance
Definition ALSBaseCharacter.h:613

◆ JumpAction()

void ACustomCharacterBase::JumpAction ( bool bValue)
overridevirtual

Reimplemented from AALSBaseCharacter.

919{
920 if(GetIsFlying())
921 {
922 GetWorldTimerManager().ClearTimer(FlyingTimerHandle);
923 if(bValue)
924 {
925 GetWorldTimerManager().SetTimer(FlyingTimerHandle, this, &ACustomCharacterBase::FlyUp, 0.01, true);
926 bIsFlyingUp = true;
927 bIsFlyingDown = false;
928 }
929 else
930 {
931 GetWorldTimerManager().ClearTimer(FlyingTimerHandle);
932 }
933 return;
934 }
935 Super::JumpAction(bValue);
936}
bool GetIsFlying() const
Definition ALSBaseCharacter.h:347
bool bIsFlyingDown
Definition CustomCharacterBase.h:271
FTimerHandle FlyingTimerHandle
Definition CustomCharacterBase.h:454
void FlyUp()
Definition CustomCharacterBase.cpp:938
bool bIsFlyingUp
Definition CustomCharacterBase.h:269

◆ Landed()

void ACustomCharacterBase::Landed ( const FHitResult & Hit)
overridevirtual

Reimplemented from AALSBaseCharacter.

848{
849 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
850 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::Landed);
851 const float FallVelocity = FMath::Abs(GetCharacterMovement()->Velocity.Z);
852 if(FallVelocity > RagdollOnLandVelocity)
853 {
854 const float FallDamage = (FallVelocity - FallDamageOffset) / FallDamageDivisor;
855 if(GetController() != nullptr)
856 {
857 float DamageMultiplier = 1.0f;
858 const int32 LuckChance = FMath::RandRange(0, (100 / GetLuck()));
859 if(LuckChance == 0)
860 {
861 //@ TODO Notification for Player of Luck Even Happening
862 DamageMultiplier = FMath::RandRange(1, GetLuck());
863 if(bDebuggingMode){UE_LOG(LogCustomCharacters, Warning, TEXT("LUCK EVENT, Fall Damage Reduced by factor of: %f"), DamageMultiplier);}
864 }
865 UGameplayStatics::ApplyDamage(this, (FallDamage / DamageMultiplier), GetController(), this, UFallDamage::StaticClass());
866 //@TODO Play sound
867 }
868 const float StaminaDamage = FMath::Clamp(FallDamage, 0.0f, Stamina);
869 // UBaseHelpersBPLib::PrintToLog(this, FString("StaminaDamage: ") + FString::SanitizeFloat(StaminaDamage) + __FUNCTION__, true);
870 Stamina -= StaminaDamage;
871 if(!GetWorldTimerManager().IsTimerActive(StaminaRechargeTimerHandle))
872 {
874 }
876 }
877 //- Super needs to be called after, otherwise velocity will be 0
878 Super::Landed(Hit);
879}
float RagdollOnLandVelocity
Definition ALSBaseCharacter.h:659
virtual int32 GetLuck() const
Definition CharacterBase.h:100
FTimerHandle StaminaRechargeTimerHandle
Definition CustomCharacterBase.h:452
virtual void RechargeStamina()
Definition CustomCharacterBase.cpp:1072
float FallDamageDivisor
Definition CustomCharacterBase.h:237
float FallDamageOffset
Definition CustomCharacterBase.h:234
float StaminaRechargeDelayTime
Definition CustomCharacterBase.h:297
float StaminaRechargeRate
Definition CustomCharacterBase.h:291
virtual void UpdateStaminaHUD()
Definition CustomCharacterBase.cpp:1146
virtual void Landed(const FHitResult &Hit) override
Definition CustomCharacterBase.cpp:847

◆ LoadCharacterData()

bool ACustomCharacterBase::LoadCharacterData ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

356{
357 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
358
359 IMenuSystem* MenuSystem = Cast<IMenuSystem>(GetGameInstance());
360 if(MenuSystem != nullptr)
361 {
362 //- TODO move this to BP Library to always get same result //
363 FString CurrentSaveSlotName;
364 const int32 CurrentSaveSlot = MenuSystem->GetCurrentSaveSlot();
365 const FString CharacterSlotName = CurrentSaveSlotName.Append((FString::FromInt(CurrentSaveSlot) + " Character " + DisplayName));
366 if(UGameplayStatics::DoesSaveGameExist(CharacterSlotName, 0))
367 {
368 USaveGame* LoadedSaveGame = UGameplayStatics::LoadGameFromSlot(CharacterSlotName, 0);
369 const UCharacterSaveGame* LoadedCharacterSaveGame = Cast<UCharacterSaveGame>(LoadedSaveGame);
370 if(LoadedCharacterSaveGame != nullptr)
371 {
372 SetDesiredGait(LoadedCharacterSaveGame->SavedGait);
373 SetDesiredStance(LoadedCharacterSaveGame->SavedStance);
374 SetOverlayState(LoadedCharacterSaveGame->SavedOverlayState);
375 SetActorTransform(LoadedCharacterSaveGame->SavedCharacterTransform);
376 // SetRotationMode(LoadedCharacterSaveGame->SavedRotationMode);
377 return true;
378 }
379 }
380 }
381 return false;
382}
void SetDesiredStance(EALSStance NewStance)
Definition ALSBaseCharacter.cpp:449
void SetOverlayState(EALSOverlayState NewState, bool bForce=false)
Definition ALSBaseCharacter.cpp:587
void SetDesiredGait(EALSGait NewGait)
Definition ALSBaseCharacter.cpp:474
Definition MenuSystem.h:19
Definition MenuSystem.Build.cs:6
Definition CharacterSaveGame.h:14
EALSStance SavedStance
Definition CharacterSaveGame.h:24
EALSOverlayState SavedOverlayState
Definition CharacterSaveGame.h:20
EALSGait SavedGait
Definition CharacterSaveGame.h:22
FTransform SavedCharacterTransform
Definition CharacterSaveGame.h:19

◆ LoadComponentsSaveData()

void ACustomCharacterBase::LoadComponentsSaveData ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

385{
386 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
387
388 IMenuSystem* MenuSystem = Cast<IMenuSystem>(GetGameInstance());
389 if(MenuSystem != nullptr)
390 {
391 //@TODO New Save Slot name
392 FString CurrentSaveSlotName;
393 const int32 CurrentSaveSlot = MenuSystem->GetCurrentSaveSlot();
394 const FString CharacterSlotName = CurrentSaveSlotName.Append((FString::FromInt(CurrentSaveSlot) + " Character " + DisplayName));
395
396 // const FString CurrentSaveSlotName = MenuSystem->GetCurrentSaveSlotName();
397 bool bHealthLoaded = false;
398 if(CharacterHealthComponent != nullptr)
399 {
400 bHealthLoaded = CharacterHealthComponent->LoadComponentData(CurrentSaveSlotName);
401 }
402 if(!bHealthLoaded)
403 {
404
405 }
406 }
407}

◆ LoadGameData()

void ACustomCharacterBase::LoadGameData ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

305{
306 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
308 // SetupComponents();
309 // CurrentWeapon->GetChildActor()->SetOwner(this);
311}
virtual bool LoadCharacterData()
Definition CustomCharacterBase.cpp:355
virtual void LoadComponentsSaveData()
Definition CustomCharacterBase.cpp:384

◆ NotifyHit()

void ACustomCharacterBase::NotifyHit ( UPrimitiveComponent * MyComp,
AActor * Other,
UPrimitiveComponent * OtherComp,
bool bSelfMoved,
FVector HitLocation,
FVector HitNormal,
FVector NormalImpulse,
const FHitResult & Hit )
overridevirtual

Reimplemented from ACharacterBase.

Reimplemented in ACustomAICharacter.

445{
446 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
447
448 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::NotifyHit);
449 Super::NotifyHit(MyComp, Other, OtherComp, bSelfMoved, HitLocation, HitNormal, NormalImpulse, Hit);
450 if(bIsDead || !bCanBePushed){return;}
451 if(Other == nullptr){return;}
452 if(bDebuggingMode && GetWorld() != nullptr)
453 {
454 DrawDebugBox(GetWorld(), Hit.TraceStart, FVector(1.0f,1.0f,1.0f), FColor::Black, false, 1.0, 0, 1.0f);
455 DrawDebugBox(GetWorld(), HitLocation, FVector(1.0f,1.0f,1.0f), FColor::Red, false, 1.0, 0, 1.0f);
456 }
457 const float Velocity = Other->GetVelocity().Length();
458 if(Velocity < HitVelocityThreshold){return;}
459 const FRotator LookAtRot = UKismetMathLibrary::FindLookAtRotation(Hit.TraceStart, HitLocation);
460 const FVector ForwardVector = LookAtRot.Vector();
461
462 //- Normalize to get just the direction
463 // const FVector ForceDirection = HitNormal.GetSafeNormal();
464 //- Directly use the impulse from the hit
465 // const FVector Force = NormalImpulse;
467 {
468 //- Adding movement input fixes feet sticking to the floor //
469 AddMovementInput(ForwardVector * Velocity);
470
471 }
473 {
474 PhysicalHitReactionComponent->HitReaction(Hit.BoneName, HitLocation, (HitReactionMultiplier / GetStrength()));
475 }
476
477 const FVector Force = ForwardVector * 500.0f * (Velocity * (HitVelocityMultiplier / GetStrength()));
478 // const FVector ForceMagnitude = (Force + ForwardVector) * 500.0f * (Velocity * (HitVelocityMultiplier / GetStrength()));
479 // const float ForceMagnitude = ForwardVector * 500.0f * (Velocity * (HitVelocityMultiplier / GetStrength()));
480
481 if(bAddCharacterMovement && GetCharacterMovement() != nullptr)
482 {
483 GetCharacterMovement()->AddForce(FVector(Force.X,Force.Y,0.0f));
484 }
485 const float CharacterVelocity = (GetVelocity().Length() / GetStrength());
486 if(CharacterVelocity > PushFallVelocityThreshold || (Velocity / GetStrength()) > PushedFallVelocityThreshold)
487 {
489 }
490}
bool bPushHitReaction
Definition CharacterBase.h:169
float HitVelocityThreshold
Definition CharacterBase.h:163
float PushFallVelocityThreshold
Definition CharacterBase.h:176
float HitVelocityMultiplier
Definition CharacterBase.h:165
virtual void FallOver(const float WaitTime)
Definition CharacterBase.cpp:94
bool bAddMovementInput
Definition CharacterBase.h:171
float PushedFallOverWaitTime
Definition CharacterBase.h:181
bool bAddCharacterMovement
Definition CharacterBase.h:173
float HitReactionMultiplier
Definition CharacterBase.h:167
float PushedFallVelocityThreshold
Definition CharacterBase.h:179
bool bCanBePushed
Definition CharacterBase.h:161
virtual int32 GetStrength() const
Definition CharacterBase.h:84
virtual void NotifyHit(UPrimitiveComponent *MyComp, AActor *Other, UPrimitiveComponent *OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult &Hit) override
Definition CustomCharacterBase.cpp:443

◆ OnAimAssistOverlap()

void ACustomCharacterBase::OnAimAssistOverlap ( UPrimitiveComponent * OverlappedComponent,
AActor * OtherActor,
UPrimitiveComponent * OtherComp,
const int32 OtherBodyIndex,
const bool bFromSweep,
const FHitResult & SweepResult )
protected

◆ OnCharacterReadyReplicated()

void ACustomCharacterBase::OnCharacterReadyReplicated ( )
protected
248{
250}
virtual void OnPawnSpawned() override
Definition CustomCharacterBase.cpp:228

◆ OnCharacterVehicleModeChanged()

void ACustomCharacterBase::OnCharacterVehicleModeChanged ( const EVehicleMode Mode)

◆ OnDeath()

void ACustomCharacterBase::OnDeath ( AActor * OwningActor,
const EDeathType DeathType,
AActor * DeathCauser,
AController * DeathInstigator )
protectedvirtual

Reimplemented in ACampaignAICharacter, ACampaignPlayerCharacter, ACustomAICharacter, and ACustomPlayerCharacter.

1264{
1265 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1266 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::OnDeath);
1267 //@TODO Actual Aim Influence
1268 AimAssistInfluence = 0.0f;
1269 bIsDead = true;
1271 // RagdollStart();
1272 GetWorld()->GetTimerManager().ClearTimer(FallOverTimerHandle);
1273 //- Set all Components dead //
1274 if(PhysicalHitReactionComponent != nullptr)
1275 {
1276 // PhysicalAnimationComponent->SetIsDead(bIsDead);
1277 PhysicalHitReactionComponent->OwnerDeath();
1278 }
1279 if(InteractionComponent != nullptr)
1280 {
1281 InteractionComponent->SetIsDead(bIsDead);
1282 // InteractionComponent->OwnerDeath();
1283 }
1284 // if(DialogueComponent != nullptr)
1285 // {
1286 // DialogueComponent->SetIsDead(bIsDead);
1287 // DialogueComponent->DestroyComponent();
1288 // }
1289 if(AimAssistSphereComponent != nullptr)
1290 {
1291 AimAssistSphereComponent->DestroyComponent();
1292 }
1293 if(GetCharacterMovement() != nullptr)
1294 {
1295 GetCharacterMovement()->DisableMovement();
1296 }
1297 // if (GetMesh()->GetCollisionEnabled() != ECollisionEnabled::NoCollision &&
1298 // (GetMesh()->GetCollisionObjectType() == ECollisionChannel::ECC_PhysicsBody ||
1299 // GetMesh()->GetCollisionObjectType() == ECollisionChannel::ECC_WorldDynamic))
1300 // {
1301 // GetMesh()->SetSimulatePhysics(true);
1302 // }
1303 InteractableActorComponent->InteractionData.InteractionTypes.Add(FInteractionType(EInteractionType::Inspect));
1304 InteractableActorComponent->InteractionData.SetDefault(EInteractionType::Inspect);
1305
1306 // InteractionData.DefaultInteraction = EInteractionType::Inspect;
1307
1308
1309 //
1310 //@TODO Extract to new function
1311 FPlayerDeath PlayerDeath = GetPlayerDeathInfo(DeathType, DeathCauser, DeathInstigator);
1312 PlayerDeath.VictimActor = this;
1313
1314 // PlayerDeath.CauseOfDeath = DeathType;
1315 // const IBaseInterface* AttackerWeapon = Cast<IBaseInterface>(DeathCauser);
1316 // if(AttackerWeapon != nullptr)
1317 // {
1318 // PlayerDeath.WeaponID = AttackerWeapon->GetObjectDisplayName();
1319 // }
1320 // if(bIsNPC)
1321 // {
1322 // PlayerDeath.VictimTeamID = MAX_int32;
1323 // PlayerDeath.Victim = GetObjectDisplayName();
1324 // PlayerDeath.bAIVictim = true;
1325 // }
1326 // if(DeathInstigator != nullptr)
1327 // {
1328 // PlayerDeath.bAIAttacker = !DeathInstigator->IsPlayerController();
1329 // const IGenericTeamAgentInterface* AttackerController = Cast<IGenericTeamAgentInterface>(DeathInstigator->GetPlayerState<APlayerState>());
1330 // if(AttackerController != nullptr)
1331 // {
1332 // PlayerDeath.AttackerTeamID = AttackerController->GetGenericTeamId().GetId();
1333 // }
1334 // ACustomPlayerState* CustomAttackerPlayerState = Cast<ACustomPlayerState>(DeathInstigator->GetPlayerState<APlayerState>());
1335 // if(CustomAttackerPlayerState != nullptr)
1336 // {
1337 // PlayerDeath.AttackerPlayerState = CustomAttackerPlayerState;
1338 // }
1339 // }
1340 //
1341 // const IGenericTeamAgentInterface* VictimController = Cast<IGenericTeamAgentInterface>(GetPlayerState());
1342 // if(VictimController != nullptr)
1343 // {
1344 // PlayerDeath.VictimTeamID = VictimController->GetGenericTeamId().GetId();
1345 // }
1346 // if(PlayerDeath.AttackerTeamID == PlayerDeath.VictimTeamID)
1347 // {
1348 // PlayerDeath.bTeamKill = true;
1349 // }
1350 // UE_LOG(LogTemp, Warning, TEXT("Victim ID: %i, Attacker ID: %i"), PlayerDeath.VictimTeamID, PlayerDeath.AttackerTeamID);
1351 //
1352 // ACustomPlayerState* CustomVictimPlayerState = Cast<ACustomPlayerState>(GetPlayerState());
1353 // if(CustomVictimPlayerState != nullptr)
1354 // {
1355 // PlayerDeath.VictimPlayerState = CustomVictimPlayerState;
1356 // }
1357 // if(PlayerDeath.AttackerPlayerState == PlayerDeath.VictimPlayerState)
1358 // {
1359 // PlayerDeath.bSelfDeath = true;
1360 // }
1361
1362
1363
1364 //@ todo TEMp turn off
1365 // IOnlineGM* OnlineGM = GetWorld()->GetAuthGameMode<IOnlineGM>();
1366 // if(OnlineGM != nullptr)
1367 // {
1368 // if(bIsNPC)
1369 // {
1370 // OnlineGM->AIDeath(PlayerDeath);
1371 //
1372 // }
1373 // else
1374 // {
1375 // OnlineGM->PlayerDeath(PlayerDeath);
1376 // }
1377 // OnCharacterDeath.Broadcast(PlayerDeath, this);
1378 // RagdollStart();
1379 // return;
1380 // }
1381 PlayerDeath.CauseOfDeath = DeathType;
1382 const IBaseInterface* AttackerWeapon = Cast<IBaseInterface>(DeathCauser);
1383 if(AttackerWeapon != nullptr)
1384 {
1385 PlayerDeath.WeaponID = AttackerWeapon->GetObjectDisplayName();
1386 }
1387 if(bIsNPC)
1388 {
1389 PlayerDeath.VictimTeamID = MAX_int32;
1390 PlayerDeath.Victim = GetObjectDisplayName();
1391 PlayerDeath.bAIVictim = true;
1392 }
1393 if(DeathInstigator != nullptr)
1394 {
1395 PlayerDeath.bAIAttacker = !DeathInstigator->IsPlayerController();
1396 const IGenericTeamAgentInterface* AttackerController = Cast<IGenericTeamAgentInterface>(DeathInstigator->GetPlayerState<APlayerState>());
1397 if(AttackerController != nullptr)
1398 {
1399 PlayerDeath.AttackerTeamID = AttackerController->GetGenericTeamId().GetId();
1400 }
1401 ACustomPlayerState* CustomAttackerPlayerState = Cast<ACustomPlayerState>(DeathInstigator->GetPlayerState<APlayerState>());
1402 if(CustomAttackerPlayerState != nullptr)
1403 {
1404 PlayerDeath.AttackerPlayerState = CustomAttackerPlayerState;
1405 }
1406 }
1407
1408 const IGenericTeamAgentInterface* VictimController = Cast<IGenericTeamAgentInterface>(GetPlayerState());
1409 if(VictimController != nullptr)
1410 {
1411 PlayerDeath.VictimTeamID = VictimController->GetGenericTeamId().GetId();
1412 }
1413 if(PlayerDeath.AttackerTeamID == PlayerDeath.VictimTeamID)
1414 {
1415 PlayerDeath.bTeamKill = true;
1416 }
1417 UE_LOG(LogTemp, Warning, TEXT("Victim ID: %i, Attacker ID: %i"), PlayerDeath.VictimTeamID, PlayerDeath.AttackerTeamID);
1418
1419 ACustomPlayerState* CustomVictimPlayerState = Cast<ACustomPlayerState>(GetPlayerState());
1420 if(CustomVictimPlayerState != nullptr)
1421 {
1422 PlayerDeath.VictimPlayerState = CustomVictimPlayerState;
1423 }
1424 if(PlayerDeath.AttackerPlayerState == PlayerDeath.VictimPlayerState)
1425 {
1426 PlayerDeath.bSelfDeath = true;
1427 }
1428
1429 // IMultiplayerGM* MultiplayerGm = GetWorld()->GetAuthGameMode<IMultiplayerGM>();
1430 // if(MultiplayerGm != nullptr)
1431 // {
1432 // if(bIsNPC)
1433 // {
1434 // MultiplayerGm->AIDeath(PlayerDeath);
1435 //
1436 // }
1437 // else
1438 // {
1439 // MultiplayerGm->PlayerDeath(PlayerDeath);
1440 // }
1441 // }
1442 OnCharacterDeath.Broadcast(PlayerDeath, this);
1443 RagdollStart();
1444}
FOnCharacterDeath OnCharacterDeath
Definition CharacterBase.h:39
FTimerHandle FallOverTimerHandle
Definition CustomCharacterBase.h:453
FPlayerDeath GetPlayerDeathInfo(const EDeathType DeathType, AActor *DeathCauser, const AController *DeathInstigator) const
Definition CustomCharacterBase.cpp:1446
virtual void OnDeathReplicated()
Definition CustomCharacterBase.cpp:1515
virtual void RagdollStart() override
Definition CustomCharacterBase.cpp:811
AActor * VictimActor
Definition BaseData.h:623

◆ OnDeathReplicated()

void ACustomCharacterBase::OnDeathReplicated ( )
protectedvirtual

Reimplemented in ACustomAICharacter.

1516{
1517 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1518 RagdollStart();
1519 AimAssistInfluence = 0.0f;
1520 if(GetCharacterMovement() != nullptr)
1521 {
1522 GetCharacterMovement()->DisableMovement();
1523 }
1524 if(PhysicalHitReactionComponent != nullptr)
1525 {
1526 // PhysicalAnimationComponent->SetIsDead(bIsDead);
1527 PhysicalHitReactionComponent->OwnerDeath();
1528 }
1529 if(InteractionComponent != nullptr)
1530 {
1531 InteractionComponent->SetIsDead(bIsDead);
1532 // InteractionComponent->OwnerDeath();
1533 }
1534 if(AimAssistSphereComponent != nullptr)
1535 {
1536 AimAssistSphereComponent->DestroyComponent();
1537 }
1538 if(HealthBarComponent != nullptr)
1539 {
1540 HealthBarComponent->SetCollapsed(true);
1541 HealthBarComponent->DestroyComponent();
1542 }
1543
1544
1545 InteractableActorComponent->InteractionData.InteractionTypes.Add(FInteractionType(EInteractionType::Inspect));
1546 InteractableActorComponent->InteractionData.SetDefault(EInteractionType::Inspect);
1547 // InteractionData.DefaultInteraction = EInteractionType::Inspect;
1548
1549}

◆ OnFullDamageHit()

void ACustomCharacterBase::OnFullDamageHit ( AController * InstigatedBy,
const float TotalDamage,
const UDamageType * DamageType,
const FName & HitBone,
const FVector & HitLocation,
const bool bKillingHit,
const bool bInjuredPart )
protectedvirtual

Reimplemented in ACustomAICharacter, and ACustomPlayerCharacter.

1183{
1184 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1185 if(InstigatedBy == nullptr){LogMissingPointer("Instigated By in ACustomCharacterBase::OnFullDamageHit");}
1186 if(InstigatedBy != nullptr && InstigatedBy->GetPawn() != nullptr)
1187 {
1188 IHitMarkerInterface* HitMarkerActor = Cast<IHitMarkerInterface>(InstigatedBy->GetPawn());
1189 if(HitMarkerActor != nullptr)
1190 {
1191 HitMarkerActor->HitMarker(this, TotalDamage, DamageType, HitBone, HitLocation, bKillingHit, bInjuredPart);
1192 }
1193 }
1194}
Definition HitMarkerInterface.h:16
virtual void HitMarker(const AActor *ActorHit, const float Damage, const UDamageType *DamageType, const FName HitBone, const FVector HitLocation, const bool bKillingHit=false, const bool bInjuredPart=false)=0

◆ OnHealthAndShieldChanged()

void ACustomCharacterBase::OnHealthAndShieldChanged ( float Health,
float MaxHealth,
float ShieldHealth,
float MaxShieldHealth,
const class UDamageType * DamageType )
protectedvirtual
1177{
1178 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1179}

◆ OnInjuredBodyPart()

void ACustomCharacterBase::OnInjuredBodyPart ( const EBodyPartName InjuredBodyPart,
const FVector & HitLocation,
const TArray< FBodyPart > & AllBodyParts )
protectedvirtual

Reimplemented in ACustomAICharacter.

1198{
1199 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1200 switch (InjuredBodyPart)
1201 {
1202 default:
1204 // if(PhysicalHitReactionComponent != nullptr)
1205 // {
1206 // PhysicalHitReactionComponent->TogglePhysicalAnimation(true, InjuredBodyPart, EPhysicalBodyStrength::Weak);
1207 // }
1208 break;
1210 break;
1212 // if(PhysicalHitReactionComponent != nullptr)
1213 // {
1214 // PhysicalHitReactionComponent->TogglePhysicalAnimation(true, InjuredBodyPart, EPhysicalBodyStrength::Weak);
1215 // }
1216 break;
1218 // if(PhysicalHitReactionComponent != nullptr)
1219 // {
1220 // PhysicalHitReactionComponent->TogglePhysicalAnimation(true, InjuredBodyPart, EPhysicalBodyStrength::Weak);
1221 // }
1222 break;
1224 break;
1226 break;
1228 //@TODO Change Stamina based on injury
1229 SetMaxStamina(-10.0f);
1230 // Max Speed Change
1231 break;
1233 SetMaxStamina(-10.0f);
1234 // Max Speed Change
1235 break;
1236 }
1237}
virtual void SetMaxStamina(const float AmountToAdd)
Definition CustomCharacterBase.cpp:1089

◆ OnJumped_Implementation()

void ACustomCharacterBase::OnJumped_Implementation ( )
overridevirtual

Reimplemented from AALSBaseCharacter.

951{
952 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
953 Super::OnJumped_Implementation();
954 // UBaseHelpersBPLib::PrintToLog(this, FString("Stamina: JUMP ") + FString::SanitizeFloat(Stamina), true);
956 GetWorldTimerManager().ClearTimer(StaminaRechargeTimerHandle);
959}

◆ OnKnockedOut()

void ACustomCharacterBase::OnKnockedOut ( const class UDamageType * DamageType,
const float WaitTime )
protectedvirtual
1248{
1249 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1250 //@TODO Actual Aim Influence
1251 AimAssistInfluence = 0.5f;
1252 RagdollStart();
1253}

◆ OnPawnSpawned()

void ACustomCharacterBase::OnPawnSpawned ( )
overridevirtual

Reimplemented from AInteractableCharacter.

Reimplemented in ACampaignPlayerCharacter, and ACustomPlayerCharacter.

229{
230 Super::OnPawnSpawned();
231 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
232 if(bCharacterReady == false)
233 {
234 if(bIsNPC)
235 {
237 }
239 }
240 if(IsLocallyControlled() && bCharacterReady == false)
241 {
243 }
245}
virtual void SetupComponents(AController *ControllerReference=nullptr, AActor *HUDReference=nullptr, bool bIsLocallyControlled=false)
Definition CustomCharacterBase.cpp:252
bool bCharacterReady
Definition CustomCharacterBase.h:444

◆ OnShieldBreak()

void ACustomCharacterBase::OnShieldBreak ( )
protectedvirtual
1240{
1241 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1242
1243 //@ TODO Spawn System
1244 //@ TODO Create Shield Break System
1245}

◆ OnStartThreatIndication()

void ACustomCharacterBase::OnStartThreatIndication ( AActor * PawnThreat)

◆ OnStopThreatIndication()

void ACustomCharacterBase::OnStopThreatIndication ( )

◆ OnUpdateThreatIndication()

void ACustomCharacterBase::OnUpdateThreatIndication ( const FVector & Location,
const float DetectionAmount )

◆ OnWakeUp()

void ACustomCharacterBase::OnWakeUp ( )
protectedvirtual

Reimplemented in ACustomAICharacter.

1256{
1257 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1258 //@TODO Actual Aim Influence
1259 AimAssistInfluence = 1.0f;
1260 RagdollEnd();
1261}
virtual void RagdollEnd() override
Definition CustomCharacterBase.cpp:829

◆ PickupAttachmentCheck()

bool ACustomCharacterBase::PickupAttachmentCheck ( const FWeaponAttachment & In_WeaponAttachmentData)
overridevirtual

Implements ICharacterWeaponPickups.

Reimplemented in ACustomPlayerCharacter.

730{
731 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
732
733 return false;
734}

◆ PickupAttachmentEvent()

void ACustomCharacterBase::PickupAttachmentEvent ( const FString & WeaponAttachmentID)
overridevirtual

Implements ICharacterWeaponPickups.

Reimplemented in ACustomPlayerCharacter.

737{
738 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
739
740 return;
741}

◆ PickupGunCheck()

bool ACustomCharacterBase::PickupGunCheck ( const FWeaponData_T & In_WeaponData)
overridevirtual

Implements ICharacterWeaponPickups.

Reimplemented in ACustomAICharacter, and ACustomPlayerCharacter.

723{
724 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
725
726 return false;
727}

◆ PickupGunEvent()

int32 ACustomCharacterBase::PickupGunEvent ( const FWeaponData_T In_WeaponData)
overridevirtual

Implements ICharacterWeaponPickups.

Reimplemented in ACustomAICharacter, and ACustomPlayerCharacter.

716{
717 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
718
719 return 0;
720}

◆ RagdollEnd()

void ACustomCharacterBase::RagdollEnd ( )
overridevirtual

Reimplemented from AALSCharacter.

Reimplemented in ACustomAICharacter.

830{
831 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
832 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::RagdollEnd);
833 if(GetIsDead()){return;}
834 Super::RagdollEnd();
835 if(AimAssistSphereComponent != nullptr)
836 {
837 AimAssistSphereComponent->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
838 }
839 // GetCustomMesh()->bOnlyAllowAutonomousTickPose = false;
840 if(PhysicalHitReactionComponent != nullptr)
841 {
842 PhysicalHitReactionComponent->SetStrengthMultiplier(1);
843 PhysicalHitReactionComponent->SetDisabled(false);
844 }
845}
virtual bool GetIsDead() const override
Definition CustomCharacterBase.h:54

◆ RagdollStart()

void ACustomCharacterBase::RagdollStart ( )
overridevirtual

Reimplemented from AALSCharacter.

Reimplemented in ACustomAICharacter.

812{
813 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
814 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::RagdollStart);
815 if(AimAssistSphereComponent != nullptr)
816 {
817 AimAssistSphereComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
818 }
819 if(PhysicalHitReactionComponent != nullptr)
820 {
821 PhysicalHitReactionComponent->SetStrengthMultiplier(0);
822 PhysicalHitReactionComponent->SetDisabled();
823 }
824 Super::RagdollStart();
825
826 // GetCustomMesh()->bOnlyAllowAutonomousTickPose = true;
827}

◆ ReceiveEndFocus_Implementation()

void ACustomCharacterBase::ReceiveEndFocus_Implementation ( AActor * Caller)
overridevirtual

Reimplemented in ACustomAICharacter.

600{
601 Super::ReceiveEndFocus_Implementation(Caller);
602 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
603 if(bAlwaysShowOutline == false)
604 {
605 ShowMeshOutline(false);
606 }
607 if(HealthBarComponent != nullptr)
608 {
609 HealthBarComponent->SetCollapsedAfterFocus();
610 }
611}
bool bAlwaysShowOutline
Definition InteractableCharacter.h:68

◆ ReceiveOnPawnSpawn()

void ACustomCharacterBase::ReceiveOnPawnSpawn ( )

To set any Variables that need to be set on Spawn, Replicated for late joining also

◆ ReceiveStartFocus_Implementation()

void ACustomCharacterBase::ReceiveStartFocus_Implementation ( AActor * Caller)
overridevirtual

Reimplemented in ACustomAICharacter.

588{
589 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
590 Super::ReceiveStartFocus_Implementation(Caller);
591 ShowMeshOutline(true);
592 if(GetIsDead()){return;}
593 if(HealthBarComponent != nullptr)
594 {
595 HealthBarComponent->ShowHealthBar();
596 }
597}

◆ RechargeStamina()

void ACustomCharacterBase::RechargeStamina ( )
protectedvirtual
1073{
1074 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1075 const float Rate = StaminaRechargeIncrement; // This is the base recharge rate when stamina is almost empty
1076 const float Ratio = Stamina / MaxStamina;
1077 const float Multiplier = Ratio * Ratio; // This will give you a multiplier between 0 and 1 that's squared.
1078 const float ActualRecharge = Rate * (1 + Multiplier); // This makes it recharge faster as stamina increases.
1079 Stamina += ActualRecharge;
1080 // UBaseHelpersBPLib::PrintToLog(this, FString("Recharge Stamina: ") + FString::SanitizeFloat(Stamina), true);
1081 if(Stamina >= MaxStamina)
1082 {
1084 GetWorldTimerManager().ClearTimer(StaminaRechargeTimerHandle);
1085 }
1087}
float StaminaRechargeIncrement
Definition CustomCharacterBase.h:293

◆ RightMovementAction()

void ACustomCharacterBase::RightMovementAction ( float Value)
overridevirtual

Reimplemented from AALSBaseCharacter.

803{
804 Super::RightMovementAction(Value);
805 if(bSprinting && (Value <= SprintDeadZone && Value >= -SprintDeadZone))
806 {
808 }
809}

◆ SaveCharacterData()

bool ACustomCharacterBase::SaveCharacterData ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

314{
315 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
316
317 IMenuSystem* MenuSystem = Cast<IMenuSystem>(GetGameInstance());
318 if(MenuSystem != nullptr)
319 {
320 FString CurrentSaveSlotName;
321 const int32 CurrentSaveSlot = MenuSystem->GetCurrentSaveSlot();
322 const FString CharacterSlotName = CurrentSaveSlotName.Append((FString::FromInt(CurrentSaveSlot) + " Character " + DisplayName));
323 if(UGameplayStatics::DoesSaveGameExist(CharacterSlotName, 0))
324 {
325 USaveGame* LoadedSaveGame = UGameplayStatics::LoadGameFromSlot(CharacterSlotName, 0);
326 UCharacterSaveGame* LoadedCharacterSaveGame = Cast<UCharacterSaveGame>(LoadedSaveGame);
327 if(LoadedCharacterSaveGame != nullptr)
328 {
329 LoadedCharacterSaveGame->SavedCharacterTransform = GetActorTransform();
330 LoadedCharacterSaveGame->SavedOverlayState = GetOverlayState();
331 LoadedCharacterSaveGame->SavedGait = GetGait();
332 LoadedCharacterSaveGame->SavedStance = GetStance();
333 // LoadedCharacterSaveGame->SavedRotationMode = GetRotationMode();
334 return UGameplayStatics::SaveGameToSlot(LoadedCharacterSaveGame, CharacterSlotName, 0);
335 }
336 }
337 else
338 {
339 USaveGame* NewSaveGame = UGameplayStatics::CreateSaveGameObject(UCharacterSaveGame::StaticClass());
340 UCharacterSaveGame* NewCharacterSaveGame = Cast<UCharacterSaveGame>(NewSaveGame);
341 if(NewCharacterSaveGame != nullptr)
342 {
343 NewCharacterSaveGame->SavedCharacterTransform = GetActorTransform();
344 NewCharacterSaveGame->SavedOverlayState = GetOverlayState();
345 NewCharacterSaveGame->SavedGait = GetGait();
346 NewCharacterSaveGame->SavedStance = GetStance();
347 // NewCharacterSaveGame->SavedRotationMode = GetRotationMode();
348 return UGameplayStatics::SaveGameToSlot(NewCharacterSaveGame, CharacterSlotName, 0);
349 }
350 }
351 }
352 return false;
353}
EALSGait GetGait() const
Definition ALSBaseCharacter.h:126
EALSOverlayState GetOverlayState() const
Definition ALSBaseCharacter.h:159
EALSStance GetStance() const
Definition ALSBaseCharacter.h:114

◆ SaveComponentsData()

void ACustomCharacterBase::SaveComponentsData ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

410{
411 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
412
413 IMenuSystem* MenuSystem = Cast<IMenuSystem>(GetGameInstance());
414 if(MenuSystem != nullptr)
415 {
416 //@TODO New Save Slot name
417 FString CurrentSaveSlotName;
418 const int32 CurrentSaveSlot = MenuSystem->GetCurrentSaveSlot();
419 const FString CharacterSlotName = CurrentSaveSlotName.Append((FString::FromInt(CurrentSaveSlot) + " Character " + DisplayName));
420
421 // const FString CurrentSaveSlotName = MenuSystem->GetCurrentSaveSlotName();
422 bool bHealthSaved = false;
423 if(CharacterHealthComponent != nullptr)
424 {
425 bHealthSaved = CharacterHealthComponent->SaveComponentData(CurrentSaveSlotName);
426 }
427 if(!bHealthSaved)
428 {
429
430 }
431 //@Todo Save Character Traits
432
433 }
434}

◆ SaveGameData()

void ACustomCharacterBase::SaveGameData ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

297{
298 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
299 //@ TODO check player can save
302}
virtual void SaveComponentsData()
Definition CustomCharacterBase.cpp:409
virtual bool SaveCharacterData()
Definition CustomCharacterBase.cpp:313

◆ Server_OnPawnSpawn()

void ACustomCharacterBase::Server_OnPawnSpawn ( )

◆ SetCharacterVehicleMode()

void ACustomCharacterBase::SetCharacterVehicleMode ( const EVehicleMode Mode)
overridevirtual

Implements ICharacterInterface.

556{
558 switch (Mode)
559 {
561 break;
563 break;
565 break;
567 break;
568 }
569}
void OnCharacterVehicleModeChanged(const EVehicleMode Mode)

◆ SetGravityEnabled()

void ACustomCharacterBase::SetGravityEnabled ( const bool bValue)
overridevirtual
696{
697 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
698 if(bValue)
699 {
700 GetCharacterMovement()->GravityScale = 1.0f;
701 }
702 else
703 {
704 GetCharacterMovement()->GravityScale = 0.0f;
705 }
706}

◆ SetHandsTied()

void ACustomCharacterBase::SetHandsTied ( const bool bValue = true)
protectedvirtual

Reimplemented in ACustomAICharacter.

158{
159 bHandsTied = bValue;
160 if(bHandsTied)
161 {
163 InteractableActorComponent->InteractionData.SetInteractionHidden(EInteractionType::Untie, false);
164 }
165 else
166 {
168 InteractableActorComponent->InteractionData.SetInteractionHidden(EInteractionType::Untie, true);
169 }
170}

◆ SetMaxStamina()

void ACustomCharacterBase::SetMaxStamina ( const float AmountToAdd)
protectedvirtual
1090{
1091 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1092 //- Doesn't go below the Min stamina //
1093 MaxStamina += AmountToAdd;
1095}
float MaxPossibleStamina
Definition CustomCharacterBase.h:282
float MinStamina
Definition CustomCharacterBase.h:284

◆ SetPlayerName()

void ACustomCharacterBase::SetPlayerName ( FString Username)
inline
132{DisplayName = Username;};

◆ SetupComponents()

void ACustomCharacterBase::SetupComponents ( AController * ControllerReference = nullptr,
AActor * HUDReference = nullptr,
bool bIsLocallyControlled = false )
protectedvirtual

Reimplemented in ACustomAICharacter, ACampaignAICharacter, ACampaignPlayerCharacter, and ACustomPlayerCharacter.

253{
254 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::SetupComponents);
255 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
256 AController* ControllerToPass = Controller;
257 if(ControllerReference != nullptr){ControllerToPass = ControllerReference;}
258 // if(InteractionComponent != nullptr)
259 // {
260 // InteractionComponent->SetIsLocallyControlled(IsLocallyControlled());
261 // InteractionComponent->SetupComponent(GetCustomMesh(), GetMesh()->GetAnimInstance(), ControllerToPass, HUDReference, bIsNPC, bIsDead);
262 // }
263 if(CharacterHealthComponent != nullptr)
264 {
265 // CharacterHealthComponent->SetIsLocallyControlled(IsLocallyControlled());
266 // CharacterHealthComponent->SetupComponent(GetCustomMesh(), GetMesh()->GetAnimInstance(), ControllerToPass, HUDReference, bIsNPC, bIsDead);
267 CharacterHealthComponent->OnDamageHit.AddUniqueDynamic(this, &ACustomCharacterBase::OnFullDamageHit);
268 }
269 if(PhysicalHitReactionComponent != nullptr)
270 {
271 // PhysicalHitReactionComponent->SetIsLocallyControlled(IsLocallyControlled());
272 // PhysicalHitReactionComponent->SetupComponent(GetMesh(), GetMesh()->GetAnimInstance(), ControllerToPass, HUDReference, bIsNPC, bIsDead);
273 if(CharacterHealthComponent != nullptr)
274 {
275 CharacterHealthComponent->OnInjuredBodyPart.AddUniqueDynamic(PhysicalHitReactionComponent, &UPhysicalHitReactionsComponent::OnInjuredBodyPart);
276 CharacterHealthComponent->OnHitReaction.AddUniqueDynamic(PhysicalHitReactionComponent, &UPhysicalHitReactionsComponent::TakeHit);
277 }
278 }
279 // if(FootstepsComponent != nullptr)
280 // {
281 // FootstepsComponent->SetIsLocallyControlled(IsLocallyControlled());
282 // FootstepsComponent->SetupComponent(GetCustomMesh(), GetMesh()->GetAnimInstance(), ControllerToPass, HUDReference, bIsNPC, bIsDead);
283 // }
284 // if(MeleeComponent != nullptr)
285 // {
286 // MeleeComponent->SetIsLocallyControlled(IsLocallyControlled());
287 // MeleeComponent->SetupComponent(GetCustomMesh(), GetMesh()->GetAnimInstance(), ControllerToPass, HUDReference, bIsNPC, bIsDead);
288 // }
289 if(AudioReactionComponent != nullptr)
290 {
291 AudioReactionComponent->SetSkeletalMeshComponent(GetMesh());
292 }
293 MantleComponentReference = GetComponentByClass<UALSMantleComponent>();
294}
class UALSMantleComponent * MantleComponentReference
Definition CustomCharacterBase.h:220

◆ SetupPlayerInputComponent()

void ACustomCharacterBase::SetupPlayerInputComponent ( class UInputComponent * PlayerInputComponent)
overrideprotectedvirtual

Reimplemented from ACharacterBase.

Reimplemented in ACustomAICharacter, and ACustomPlayerCharacter.

437{
438 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
439
440 Super::SetupPlayerInputComponent(PlayerInputComponent);
441}

◆ SprintAction()

void ACustomCharacterBase::SprintAction ( bool bValue)
overridevirtual

Reimplemented from AALSBaseCharacter.

985{
986 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
987 if(GetIsFlying())
988 {
989 GetWorldTimerManager().ClearTimer(FlyingTimerHandle);
990 if(bValue)
991 {
992 GetWorldTimerManager().SetTimer(FlyingTimerHandle, this, &ACustomCharacterBase::FlyDown, 0.01, true);
993 bIsFlyingUp = false;
994 bIsFlyingDown = true;
995
996 }
997 else
998 {
999 GetWorldTimerManager().ClearTimer(FlyingTimerHandle);
1000 }
1001 return;
1002 }
1003 if(bToggleSprint)
1004 {
1005 if(bValue)
1006 {
1007 if(bSprinting)
1008 {
1009 StopSprinting();
1010 }
1011 else
1012 {
1014 {
1016 GetWorldTimerManager().ClearTimer(StaminaRechargeTimerHandle);
1017 GetWorldTimerManager().SetTimer(StaminaTimerHandle, this, &ACustomCharacterBase::Sprinting, StaminaDepletionRate, true);
1018 bSprinting = true;
1019 }
1020 }
1021 }
1022 return;
1023 }
1024
1025 if(bValue)
1026 {
1028 {
1030 GetWorldTimerManager().ClearTimer(StaminaRechargeTimerHandle);
1031 GetWorldTimerManager().SetTimer(StaminaTimerHandle, this, &ACustomCharacterBase::Sprinting, StaminaDepletionRate, true);
1032 }
1033 }
1034 else
1035 {
1037 GetWorldTimerManager().ClearTimer(StaminaTimerHandle);
1038 if(!GetWorldTimerManager().IsTimerActive(StaminaRechargeTimerHandle))
1039 {
1041 }
1042 }
1043}
float MinRequiredStamina
Definition CustomCharacterBase.h:277
virtual void Sprinting()
Definition CustomCharacterBase.cpp:1046
float StaminaDepletionRate
Definition CustomCharacterBase.h:287
FTimerHandle StaminaTimerHandle
Definition CustomCharacterBase.h:451
bool bToggleSprint
Definition CustomCharacterBase.h:259
void FlyDown()
Definition CustomCharacterBase.cpp:944

◆ Sprinting()

void ACustomCharacterBase::Sprinting ( )
protectedvirtual
1047{
1048 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1050 {
1051 if(Stamina > 0.0f)
1052 {
1054 }
1055 // UBaseHelpersBPLib::PrintToLog(this, FString("Stamina: ") + FString::SanitizeFloat(Stamina) + __FUNCTION__, true);
1056 if(Stamina <= 0.0f)
1057 {
1058 StopSprinting();
1059 }
1061 }
1062}
float StaminaDepletionIncrement
Definition CustomCharacterBase.h:289

◆ StanceAction()

void ACustomCharacterBase::StanceAction ( )
overridevirtual

Reimplemented from AALSBaseCharacter.

Reimplemented in ACustomPlayerCharacter.

1099{
1100 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1102 const UWorld* World = GetWorld();
1103 check(World);
1104 const float PrevStanceInputTime = LastStanceInputTime;
1105 LastStanceInputTime = World->GetTimeSeconds();
1106
1107 if (LastStanceInputTime - PrevStanceInputTime <= RollDoubleTapTimeout)
1108 {
1109 // Roll
1111
1113 {
1115 }
1116 else if (Stance == EALSStance::Crouching)
1117 {
1119 }
1120 return;
1121 }
1123 {
1125 {
1127 Crouch();
1128 //@ TODO Add Any other Components //
1129 if(FootstepsComponent != nullptr)
1130 {
1131 FootstepsComponent->SetIsCrouched(true);
1132 }
1133 }
1134 else if (Stance == EALSStance::Crouching)
1135 {
1137 UnCrouch();
1138 if(FootstepsComponent != nullptr)
1139 {
1140 FootstepsComponent->SetIsCrouched(false);
1141 }
1142 }
1143 }
1144}
EALSMovementState MovementState
Definition ALSBaseCharacter.h:598
EALSMovementAction MovementAction
Definition ALSBaseCharacter.h:604
void Replicated_PlayMontage(UAnimMontage *Montage, float PlayRate)
float LastStanceInputTime
Definition ALSBaseCharacter.h:691
float RollDoubleTapTimeout
Definition ALSBaseCharacter.h:517
UAnimMontage * GetRollAnimation()

◆ StartThreatIndication()

void ACustomCharacterBase::StartThreatIndication ( AActor * PawnThreat)
overridevirtual

Reimplemented from ICharacterInterface.

Reimplemented in ACustomPlayerCharacter.

1553{
1554 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1555 OnStartThreatIndication(PawnThreat);
1556}
void OnStartThreatIndication(AActor *PawnThreat)

◆ StopSprinting()

void ACustomCharacterBase::StopSprinting ( )
protectedvirtual
1065{
1066 GetWorldTimerManager().ClearTimer(StaminaTimerHandle);
1069 bSprinting = false;
1070}

◆ StopThreatIndication()

void ACustomCharacterBase::StopThreatIndication ( )
overridevirtual

Reimplemented from ICharacterInterface.

Reimplemented in ACustomPlayerCharacter.

1559{
1560 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1562}

◆ Tick()

void ACustomCharacterBase::Tick ( const float DeltaTime)
overrideprotectedvirtual

Reimplemented from AALSCharacter.

Reimplemented in ACustomAICharacter, ACampaignAICharacter, and ACustomPlayerCharacter.

495{
496 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
497 TRACE_CPUPROFILER_EVENT_SCOPE(ACustomCharacterBase::Tick);
498
499 Super::Tick(DeltaTime);
500}
virtual void Tick(const float DeltaTime) override
Definition CustomCharacterBase.cpp:494

◆ UpdateStaminaHUD()

void ACustomCharacterBase::UpdateStaminaHUD ( )
protectedvirtual

Reimplemented in ACustomPlayerCharacter.

1147{
1148 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
1149 //- Overridden in Player //
1150}

◆ UpdateThreatIndication()

void ACustomCharacterBase::UpdateThreatIndication ( const FVector & Location,
const float DetectionAmount )
overridevirtual

Reimplemented from ICharacterInterface.

Reimplemented in ACustomPlayerCharacter.

549{
550 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
551 OnUpdateThreatIndication(Location, DetectionAmount);
552}
void OnUpdateThreatIndication(const FVector &Location, const float DetectionAmount)

◆ WeaponEquipped()

void ACustomCharacterBase::WeaponEquipped ( const TArray< FWeaponData_T > & Weapons,
const int32 CurrentWeaponIndex )
virtual

Reimplemented in ACustomAICharacter, and ACustomPlayerCharacter.

765{
766 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
767
768 // UE_LOG(LogCustomCharacters, Warning, TEXT("Weapon Equipped Custom Character"));
769 // if(ShootingComponent->GetPlayerWeaponState().bIsHolstered){return;}
770 // if(Weapons.IsValidIndex(CurrentWeaponIndex))
771 // {
772 // const EALSOverlayState WeaponOverlayState = WeaponStateToOverlayState(Weapons[CurrentWeaponIndex].WeaponOverlay);
773 // SetOverlayState(WeaponOverlayState);
774 // }
775}

◆ WeaponStateChanged()

void ACustomCharacterBase::WeaponStateChanged ( const struct FPlayerWeaponState & PlayerWeaponState)
virtual

Reimplemented in ACustomAICharacter.

778{
779 SCOPE_CYCLE_COUNTER(STATGROUP_Custom_ALS_Character);
780 if(PlayerWeaponState.bIsHolstered)
781 {
782 if(IsLocallyControlled())
783 {
785 }
786 }
787}
bool bIsHolstered
Definition WeaponStructs.h:126

Member Data Documentation

◆ AimAssistOverlapTimerHandle

FTimerHandle ACustomCharacterBase::AimAssistOverlapTimerHandle
private

◆ AimAssistRadius

float ACustomCharacterBase::AimAssistRadius = 160.0f
protected

◆ AimAssistShrinkTime

float ACustomCharacterBase::AimAssistShrinkTime = 3.0f
protected

◆ AimAssistSphereComponent

class USphereComponent* ACustomCharacterBase::AimAssistSphereComponent
protected

Remove? use sphere trace instead //.

◆ bCharacterReady

bool ACustomCharacterBase::bCharacterReady = false
protected

◆ bForceWalkWhileAiming

bool ACustomCharacterBase::bForceWalkWhileAiming = true
protected

◆ bHandsTied

bool ACustomCharacterBase::bHandsTied = false
protected

◆ bIsDead

bool ACustomCharacterBase::bIsDead = false
protected

◆ bIsFlyingDown

bool ACustomCharacterBase::bIsFlyingDown = false
protected

◆ bIsFlyingUp

bool ACustomCharacterBase::bIsFlyingUp = false
protected

◆ bIsNPC

bool ACustomCharacterBase::bIsNPC = false
protected

◆ bSprinting

bool ACustomCharacterBase::bSprinting = true
protected

◆ bToggleSprint

bool ACustomCharacterBase::bToggleSprint = true
protected

◆ CharacterHealthComponent

class UCharacterHealthComponent* ACustomCharacterBase::CharacterHealthComponent
protected

◆ CharacterType

ECharacterType ACustomCharacterBase::CharacterType = ECharacterType::Human
protected

◆ CustomSkeletalMesh

USkeletalMeshComponent* ACustomCharacterBase::CustomSkeletalMesh
protected

◆ DisplayName

FString ACustomCharacterBase::DisplayName = "Default Name"
protected

◆ FallDamageDivisor

float ACustomCharacterBase::FallDamageDivisor = 5.0f
protected

◆ FallDamageOffset

float ACustomCharacterBase::FallDamageOffset = 550.0f
protected

◆ FallOverTimerHandle

FTimerHandle ACustomCharacterBase::FallOverTimerHandle
private

◆ FlyingScaleValue

float ACustomCharacterBase::FlyingScaleValue = 1.0f
protected

◆ FlyingTimerHandle

FTimerHandle ACustomCharacterBase::FlyingTimerHandle
private

◆ FootstepsComponent

class UFootstepFXHandler* ACustomCharacterBase::FootstepsComponent
protected

◆ HealthBarComponent

class UHealthBarWidgetComponent* ACustomCharacterBase::HealthBarComponent
protected

◆ MantleComponentReference

class UALSMantleComponent* ACustomCharacterBase::MantleComponentReference
protected

◆ MaxPossibleStamina

float ACustomCharacterBase::MaxPossibleStamina = 150.0f
protected

◆ MaxStamina

float ACustomCharacterBase::MaxStamina = 60.0f
protected

◆ MaxStaminaDefault

float ACustomCharacterBase::MaxStaminaDefault = 60.0f
protected

◆ MeleeComponent

class UMeleeComponent* ACustomCharacterBase::MeleeComponent
protected

◆ MinRequiredStamina

float ACustomCharacterBase::MinRequiredStamina = 0.2f
protected

◆ MinStamina

float ACustomCharacterBase::MinStamina = 10.0f
protected

◆ MultiplayerStartDelay

float ACustomCharacterBase::MultiplayerStartDelay = 0.5f
protected

◆ PhysicalAnimationComponent

class UPhysicalAnimationComponent* ACustomCharacterBase::PhysicalAnimationComponent
protected

◆ PhysicalHitReactionComponent

class UPhysicalHitReactionsComponent* ACustomCharacterBase::PhysicalHitReactionComponent
protected

◆ RecoilAnimationComponent

class URecoilAnimationComponent* ACustomCharacterBase::RecoilAnimationComponent
protected

◆ SprintDeadZone

float ACustomCharacterBase::SprintDeadZone = 0.5f
protected

Number of the Input to turn off sprinting

◆ Stamina

float ACustomCharacterBase::Stamina = 100.0f
protected

◆ StaminaDepletionIncrement

float ACustomCharacterBase::StaminaDepletionIncrement = 0.5f
protected

◆ StaminaDepletionRate

float ACustomCharacterBase::StaminaDepletionRate = 0.05f
protected

◆ StaminaJumpAmount

float ACustomCharacterBase::StaminaJumpAmount = 10.0f
protected

◆ StaminaRechargeDelayTime

float ACustomCharacterBase::StaminaRechargeDelayTime = 2.0f
protected

◆ StaminaRechargeIncrement

float ACustomCharacterBase::StaminaRechargeIncrement = 0.5f
protected

◆ StaminaRechargeRate

float ACustomCharacterBase::StaminaRechargeRate = 0.05f
protected

◆ StaminaRechargeTimerHandle

FTimerHandle ACustomCharacterBase::StaminaRechargeTimerHandle
private

◆ StaminaTimerHandle

FTimerHandle ACustomCharacterBase::StaminaTimerHandle
private

◆ ThrowStrength

float ACustomCharacterBase::ThrowStrength = 500.0f
protected

The documentation for this class was generated from the following files: