LEAP Documentation 40220
Documentation for the LEAP project
DeployableControlledRocket.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "DeployableControlledRocket.generated.h"
8
9class UStaticMeshComponent;
10
11UCLASS()
13{
14 GENERATED_UCLASS_BODY()
15
16public:
17 virtual void DeployComplete() override;
18 virtual void Died(float Damage, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser, APlayerState* InstigatorPlayerState) override;
19
20protected:
21 virtual void BeginPlay() override;
22 virtual void Tick(float DeltaTime) override;
23 virtual void UpdateDeployableTransform(float DeltaTime) override;
24 virtual void QueryAndInformTargets();
25 virtual void TriggerExplosion(const FVector& ExplosionLocation);
26 virtual bool CanOwningWeaponInstanceFire() const { return true; }
27 virtual void StopControlling() override;
28 virtual void Fire() override;
29
30 UFUNCTION(Reliable,Server)
31 void Server_Reliable_Fire();
32
33 UFUNCTION()
34 virtual void OnRocketHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit);
35
36 UFUNCTION(BlueprintImplementableEvent, Category = "Rocket|Explosion")
37 void K2_PlayExplosionEffects(const FVector& ExplosionLocation);
38
39 UFUNCTION(BlueprintImplementableEvent, Category = "Rocket|Widget")
40 void SetWarningState(bool bNewState);
41
42 UFUNCTION(NetMulticast, Unreliable)
43 virtual void Multicast_Explosion_PlayExplosionEffects_Unreliable(const FVector& ExplosionLocation);
44
45protected:
46 /* Distance in cms from the tip of the rocket forward that we're using to check for potential targets and warn them */
47 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Rocket")
48 float DistanceCheckForWarningTargets = 20000.f;
49 /* Anyone inside this radius will get the warning whether they're within the min dot distance or not */
50 UPROPERTY(EditDefaultsOnly, Category = "Rocket")
51 float RadiusForWarningTargets = 2000.f;
52 /* Min dot between the rocket's forward vector and the direction towards the target in order to issue the rocket warning */
53 UPROPERTY(EditDefaultsOnly, Category = "Rocket")
54 float TargetWarningMinDot = 0.93f;
55 /* Should we apply the velocity only after the deployment is complete? */
56 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement")
57 bool bApplyLaunchVelocityAfterDeploy = false;
58 /* Launch velocity of the rocket (relative to the camera) */
59 UPROPERTY(EditDefaultsOnly, Category ="Rocket|Movement")
60 FVector LaunchVelocity = FVector(1000,0,0);
61 /* The maximum speed this rocket can */
62 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement")
63 float MaxSpeed = 6000.f;
64 /* Speed increment to be applied per second to the rocket */
65 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement")
66 float SpeedIncreasePerSecond = 1000;
67 /* How fast does our mesh interpolate our position to the target one */
68 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement")
69 float LocationInterpolationSpeed = 2.f;
70 /* How fast does our mesh interpolate our position to the target one */
71 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement")
72 float RotationInterpolationSpeed = 2.f;
73
74 /* The rate in which we use to apply a "breaking force"to the yaw rotation */
75 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement|Rotation")
76 float YawBreakingRate = 1.f;
77 /* The rate in which we use to lerp our Pitch */
78 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement|Rotation")
79 float PitchAccelerationRate = 1.f;
80 /* The min/max rate in which we can accelerate our yaw rotation */
81 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement|Rotation")
82 FVector2D MinMaxYawRotationAcceleration = FVector2D(-2.f, 2.f);
83 /* A baked in offset that's used during interpolation to match the desired rotation of the rocket */
84 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Movement|Rotation")
85 FRotator RocketMeshRotationOffset = FRotator::ZeroRotator;
86
87 /* Damage Type to apply on explosion */
88 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Explosion")
89 TSubclassOf<UDamageType> ExplosionDamageType;
90 /* The amount of depenetration we apply to the explosion origin on rocket collision*/
91 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Explosion")
92 float ImpactDepenetrationAmount = 100.f;
93 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Explosion")
94 bool bUseWeaponDamageAsImpactdamage = true;
95 /* The explosion radius */
96 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Explosion")
97 float ExplosionRadius = 500.f;
98 /* The minimum damage this explosion can cause */
99 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Explosion")
100 float ExplosionDamageMin = 5000.f;
101 /* The maximum damage this explosion can cause */
102 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Explosion")
103 float ExplosionDamageMax = 5000.f;
104 /* Damage falloff from the epicenter to the border of the explosion*/
105 UPROPERTY(EditDefaultsOnly, Category = "Rocket|Explosion")
106 float ExplosionDamageFallOff = 0.8f;
107 /* How long (in seconds) since launch to apply the maximum lifetime-based damage multiplier */
108 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Rocket|Explosion")
109 float MaxLifetimeForDamageMultiplication = 5.f;
110 /* A curve to control the Ease of the damage multiplication based on the lifetime, if no curve is provided (current lifetime / MaxLifetimeForDamageMultiplication) will be used instead as a ratio to derive the damage multiplication*/
111 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Rocket|Explosion")
112 UCurveFloat* LifetimeBasedDamageMultiplierCurve = nullptr;
113private:
114 FVector PreviousRocketLocation = FVector::ZeroVector;
115 FRotator PreviousRocketRotation = FRotator::ZeroRotator;
116 FVector2D RotationAcceleration = FVector2D::ZeroVector;
117 bool bTriggeredExplosion = false;
118};
Definition: DeployableControllable.h:30
Definition: DeployableControlledRocket.h:13
virtual bool CanOwningWeaponInstanceFire() const
Definition: DeployableControlledRocket.h:26