5#include "CoreMinimal.h"
6#include "GameFramework/MovementComponent.h"
8#include "PXProjectileMovementComponent.generated.h"
20#define MED_QUALITY_DIST 25000.f
21#define LOW_QUALITY_DIST 50000.f
23UCLASS(meta = (BlueprintSpawnableComponent))
26 GENERATED_UCLASS_BODY()
31 virtual void TickComponent(
float DeltaTime,
enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
override;
32 virtual void OnReleasedToObjectPool()
override;
35 UFUNCTION(BlueprintCallable, Category = Projectile)
36 float GetSpeed()
const {
return Speed; }
37 UFUNCTION(BlueprintCallable, Category = Projectile)
38 float CanBounce()
const {
return bCanBounce; }
40 bool IsHomingProjectile()
const {
return bIsHomingProjectile; }
41 UFUNCTION(BlueprintCallable, Category = Projectile)
42 bool IsDebug()
const {
return bDebug; }
43 UFUNCTION(BlueprintCallable, Category = Projectile)
45 UFUNCTION(BlueprintCallable, Category = Projectile)
46 bool UseExtentTrace()
const {
return bUseExtentTrace && ProjectileExtent > 0.f; }
49 UFUNCTION(BlueprintCallable, Category = Projectile)
50 void SetMaxSpeed(
float InMaxSpeed) { MaxSpeed = InMaxSpeed; Speed = MaxSpeed; }
51 UFUNCTION(BlueprintCallable, Category = Projectile)
52 void SetHomingTarget(USceneComponent* Target) { HomingTargetComponent = Target; }
53 UFUNCTION(BlueprintCallable, Category = Projectile)
54 void SetAimTarget(USceneComponent* Target,
float Falloff) { AimTargetComponent = Target; AimTargetFalloff = Falloff; }
57 virtual void PerformMovement(
const float& DeltaTime);
59 bool ShouldIgnoreFriendlyTarget(
const TArray<FHitResult>& Hits)
const;
60 FVector GetProjectileInitialDirection()
const;
61 virtual FVector ComputeHomingAcceleration(
float DeltaTime)
const;
66 virtual void UpdateQualityLevel();
68 static FVector CalculateReflectionVector(
const FVector& Direction,
const FVector& ImpactNormal);
70 virtual void NotifyHit(
const FHitResult& Hit);
73 virtual void ApplyBulletWhip(
float DeltaTime,
const FVector& Start);
81 UPROPERTY(EditDefaultsOnly, Category = Projectile)
83 UPROPERTY(EditDefaultsOnly, Category = Projectile)
84 float GravityScale = 1.f;
86 UPROPERTY(EditDefaultsOnly, Category = Projectile)
87 float ProjectileExtent = 0.f;
89 UPROPERTY(EditDefaultsOnly, Category = Projectile)
90 USoundBase* BulletWhipSound = NULL;
91 UPROPERTY(EditDefaultsOnly, Category = Projectile)
92 float BulletWhipSoundDistance = 500.f;
94 bool bHasPlayedBulletWhip = false;
98 bool bUseExtentTrace = false;
100 UPROPERTY(EditDefaultsOnly, Category = Projectile)
101 bool bCanBounce = false;
103 UPROPERTY(EditDefaultsOnly, Category = Projectile)
104 bool bStopOnDamageableHit = true;
106 UPROPERTY(EditDefaultsOnly, Category = Projectile)
107 float BounceSpeedMultiplier = 0.5;
109 UPROPERTY(EditDefaultsOnly, Category = Projectile)
110 bool bIsHomingProjectile = false;
111 UPROPERTY(EditDefaultsOnly, Category = Projectile)
112 float HomingAccelerationMagnitude = 0.f;
114 UPROPERTY(EditDefaultsOnly, Category = Projectile)
115 float MaxHomingDotDeviation = .25f;
117 TArray<TWeakObjectPtr<AActor>> IgnoredActors;
118 TWeakObjectPtr<USceneComponent> HomingTargetComponent =
nullptr;
119 TWeakObjectPtr<USceneComponent> AimTargetComponent =
nullptr;
120 float AimTargetFalloff = 1.0f;
123 bool bIsLocallyControlled = false;
134 FAccelerateTowardsHomingSignature AcceleratingTowardsHomingTargetDelegate;
136 bool bUpdateRotation = true;
139 FCollisionQueryParams CQP;
EQualityMode
Definition: PXProjectileMovementComponent.h:14
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAccelerateTowardsHomingSignature, bool, bIsAccelerating)
Definition: Projectile.h:18
Definition: ObjectPoolInterface.h:16
Definition: PXProjectileMovementComponent.h:25
bool IsProjectileDestroyOnHit() const
Definition: PXProjectileMovementComponent.h:47
Definition: WeaponInstanceRanged.h:27