![]() |
Mortar Pro Plugin
Version 2
Modular Turret Plugin
|
#include <MortarProBeamProjectile.h>
Public Member Functions | |
AMortarProBeamProjectile () | |
bool | AreMultipleHitsAllowed () const |
void | BPBeamEnd () |
void | BPBeamPositionChanged (const FVector &OutStarting, const FVector &OutEnding) |
void | BPBeamStart (const FVector &OutStarting, const FVector &OutEnding) |
float | GetBeamMaxReachXOffset () const |
float | GetDamageRate () const |
float | GetInitialDelayBeforeDamage () const |
virtual void | SetAfterSpawnParam (const FMortarProAfterSpawnParam &AfterSpawnParam) override |
void | SetBeamMaxReachXOffset (const float &XMaxReach) |
void | SetDamageRate (const float &Rate) |
void | SetInitialDelayBeforeDamage (const float &InitialDelay) |
void | SetLimitBeamMaxReach (const bool &ShouldLimit) |
void | SetMultipleHitsAllowed (const bool &isAllowed) |
bool | ShouldLimitBeamMaxReach () const |
void | Tick (float DeltaTime) override |
![]() | |
void | BPOnImpactEvent () |
virtual float | GetProjectileSpeed () |
virtual void | SetAfterSpawnParam (const FMortarProAfterSpawnParam &AfterSpawnParam) |
![]() | |
AMortarProPoolableActor () | |
virtual void | DeActivateActor () |
virtual void | ReActivateActor () |
virtual void | SetDeactivateSpan (const float &Time) |
Protected Member Functions | |
virtual void | ClearTimers () override |
virtual void | EnableComponents (const bool &bEnable) override |
void | InitializeBeforeSpawnParam () override |
![]() | |
float | GetDamageAsPerSurface (const EPhysicalSurface &SurfaceType) |
virtual void | InitializeBeforeSpawnParam () override |
void | PlayImpactSoundAndParticleEffectForSurface (const EPhysicalSurface &SurfaceType, const FVector &Location) |
![]() | |
virtual void | BeginPlay () override |
virtual void | ClearTimers () |
virtual void | EnableComponents (const bool &bEnable) |
virtual void | EndPlay (const EEndPlayReason::Type EndPlayReason) override |
virtual void | InitializeBeforeSpawnParam () |
virtual void | StartTimers () |
Protected Attributes | |
class UNiagaraSystem * | NiagaraLaunchBlast = nullptr |
![]() | |
TMap< TEnumAsByte< EPhysicalSurface >, float > | DamageAsPerSurface |
FMortarProAfterSpawnParam | MortarAfterSpawnParam |
TMap< TEnumAsByte< EPhysicalSurface >, class UNiagaraSystem * > | NiagaraSurfaceImpact |
TMap< TEnumAsByte< EPhysicalSurface >, class USoundBase * > | SurfaceImpactSound |
![]() | |
uint32 | bIsActorActivated: 1 |
Private Member Functions | |
void | AimingComponentStopped () |
void | DamageToActor (FHitResult &Result) |
void | EnableDamageToTarget () |
void | GetLineTracesStartAndTarget (TArray< TPair< FVector, FVector > > &LinePoints, const FVector &StartPosition, const FVector &TargetPosition) |
FVector | GetUpdatedEndTargetPosition (const FVector &StartPosition, const FVector &EndPosition) |
Private Attributes | |
class UMortarProBarrelMeshComponent * | Barrel { nullptr } |
float | BeamMaxReachXOffset = 1000.f |
class UBoxComponent * | BeamTraceReference = nullptr |
uint32 | bEnableDamageToTarget: 1 |
uint32 | bEnableDebugBoxTrace: 1 |
uint32 | bEnableMultipleHits: 1 |
uint32 | bLimitBeamMaxReachXOffset: 1 |
float | DamageRate = 0.2f |
FRotator | GunBarrelRotation |
float | InitialDelayBeforeDamage = 0.2f |
FTimerHandle | InitialDelayTimerHandle |
float | LastDamageTime = 0.f |
FVector | LastStartPosition |
FVector | LastTargetPosition |
Additional Inherited Members | |
![]() | |
FMortarProActorActivated | BeginActivation |
FMortarProActorDeactivated | BeginDeactivation |
float | DeactivateSpan = 10.f |
Projectile class Derived from MortarProBaseProjectile class. This class of projectile is for projectiles that are continous beam like a flame thrower or laser beam.
AMortarProBeamProjectile::AMortarProBeamProjectile | ( | ) |
|
private |
Callback function for aiming component stop firing. this will deactivate the current actor Also Calls beam end blueprint function
bool AMortarProBeamProjectile::AreMultipleHitsAllowed | ( | ) | const |
Gets Whether Multiple Hits are allowed by this projectile
void AMortarProBeamProjectile::BPBeamEnd | ( | ) |
Event Called when beam is ending .This is a blueprintImplementableEvent which has to be used in blueprint
void AMortarProBeamProjectile::BPBeamPositionChanged | ( | const FVector & | OutStarting, |
const FVector & | OutEnding | ||
) |
Event Called whenever beam Position is modified
[out] | OutStarting | Containing Starting Point of Beam |
[out] | OutEnding | Containing Ending Point of Beam |
void AMortarProBeamProjectile::BPBeamStart | ( | const FVector & | OutStarting, |
const FVector & | OutEnding | ||
) |
Event Called when beam is about to fire .This is a blueprintImplementableEvent which has to be used in blueprint
[out] | OutStarting | Containing Starting Point of Beam |
[out] | OutEnding | Containing Ending Point of Beam |
|
overrideprotectedvirtual |
Clears All Timers of the projectile. Also Called on deactivation
Reimplemented from AMortarProPoolableActor.
|
private |
Damages actor that was hit by the box trace
|
overrideprotectedvirtual |
Enables/Disables All Components.This is also called when reactivating/deactivating actor for reusability
[in] | bEnable | boolean flag true to Enable and false to Disable Components |
Reimplemented from AMortarProPoolableActor.
|
private |
Callback function for enabling damage to target
float AMortarProBeamProjectile::GetBeamMaxReachXOffset | ( | ) | const |
Gets the beam Maximum Reach. By default Beam Reaches target completely.
float AMortarProBeamProjectile::GetDamageRate | ( | ) | const |
Gets Rate by which we damage the target
float AMortarProBeamProjectile::GetInitialDelayBeforeDamage | ( | ) | const |
Gets Initial Delay after which projectile candamage
|
private |
Does 5 Line traces . at each corner of box component and from middle
[out] | LinePoints | TArray of TPair with Start and End Location |
[in] | StartPosition | FVector representing start position of actor |
[in] | TargetPosition | Target Position to consider for trace |
|
private |
Calculates End Target Position based on the Beam Reach Range percentage if 100 percent is set then we return EndPosition as it is if 50 percent then we calculate the end position such that it is in middle
[in] | StartPosition | FVector containing Starting point of Beam |
[in] | EndPosition | FVector containing End Point of Beam |
|
overrideprotectedvirtual |
Resets before spawning parameters
Reimplemented from AMortarProBaseProjectile.
|
overridevirtual |
Initializes Projectile params
[in] | AfterSpawnParam | Parameters to set after spawning |
Reimplemented from AMortarProBaseProjectile.
void AMortarProBeamProjectile::SetBeamMaxReachXOffset | ( | const float & | XMaxReach | ) |
Sets Whether we want to set the maximum Beam Reach in X Offset. Only used when We are limiting Maximum Beam Reach
[in] | XMaxReach | float Variable X Offset; |
void AMortarProBeamProjectile::SetDamageRate | ( | const float & | Rate | ) |
Sets Rate by which we damage the target
[in] | Rate | float Variable telling the damage rate |
void AMortarProBeamProjectile::SetInitialDelayBeforeDamage | ( | const float & | InitialDelay | ) |
Sets Initial Delay after which this projectile can damage
[in] | InitialDelay | Initial Delay of Projectile |
void AMortarProBeamProjectile::SetLimitBeamMaxReach | ( | const bool & | ShouldLimit | ) |
Sets Whether we should limit the maximum Beam Reach in X Offset. By default beam reaches Target
[in] | ShouldLimit | bool Variable true if the beam reach should be limited false otherwise |
void AMortarProBeamProjectile::SetMultipleHitsAllowed | ( | const bool & | isAllowed | ) |
Sets Whether multiple hits are allowed by this projectile like in example of flamethrower
[in] | isAllowed | bool Variable true if multiple hits allowed false otherwise |
bool AMortarProBeamProjectile::ShouldLimitBeamMaxReach | ( | ) | const |
Gets whether we should limit the beam Maximum Reach. By default Beam Reaches target completely. If true we can set the max offset
|
override |
In this tick we do box trace to hit target
|
private |
Reference to Barrel
|
private |
Maximum Offset in X Direction the beam can reach. Only enabled in case where We limit the max reach
|
private |
Beam Trace Reference Volume. We do line trace/box trace using the reference volume In case of Single Hit we do box trace of the size of this volume In case of Multiple Hits we do multiple Line traces at each corner and center
|
private |
Flag telling whether to start box trace
|
private |
Whether to Draw Debug line from starting position to target
|
private |
Whether to Enable Multiple Hits for the beam for example. In case of Laser beam we should only have single hit but in case of flame thrower we would ideally want that the flame damges multiple targets who are in the range of flame. So in case of single hit we update the beam position based on the first target but we don't do that in case of multiple hits
|
private |
Whether to Limit the x offset of the beam range. By default the beam will reach the target. By using this flag we can set the maximum range in x direction the beam can reach
|
private |
Rate by which damage will happen to the target actor
|
private |
Rotation for Gun Barrel
|
private |
Initial Delay after which this projectile can damage
|
private |
Timer Handle for enabling Damage
|
private |
Time at which we did damage to the actor
|
private |
Last Start Position of actor
|
private |
Last Hit Position of target
|
protected |
Niagara System That will be emitted on Launch of this actor from Mortar Gun