Mortar Pro Plugin  Version 2
Modular Turret Plugin
All Classes Namespaces Functions Variables Enumerations Enumerator Pages
AMortarProBeamProjectile Class Reference

#include <MortarProBeamProjectile.h>

+ Inheritance diagram for AMortarProBeamProjectile:
+ Collaboration diagram for AMortarProBeamProjectile:

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
 
- Public Member Functions inherited from AMortarProBaseProjectile
void BPOnImpactEvent ()
 
virtual float GetProjectileSpeed ()
 
virtual void SetAfterSpawnParam (const FMortarProAfterSpawnParam &AfterSpawnParam)
 
- Public Member Functions inherited from AMortarProPoolableActor
 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
 
- Protected Member Functions inherited from AMortarProBaseProjectile
float GetDamageAsPerSurface (const EPhysicalSurface &SurfaceType)
 
virtual void InitializeBeforeSpawnParam () override
 
void PlayImpactSoundAndParticleEffectForSurface (const EPhysicalSurface &SurfaceType, const FVector &Location)
 
- Protected Member Functions inherited from AMortarProPoolableActor
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
 
- Protected Attributes inherited from AMortarProBaseProjectile
TMap< TEnumAsByte< EPhysicalSurface >, float > DamageAsPerSurface
 
FMortarProAfterSpawnParam MortarAfterSpawnParam
 
TMap< TEnumAsByte< EPhysicalSurface >, class UNiagaraSystem * > NiagaraSurfaceImpact
 
TMap< TEnumAsByte< EPhysicalSurface >, class USoundBase * > SurfaceImpactSound
 
- Protected Attributes inherited from AMortarProPoolableActor
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 UMortarProBarrelMeshComponentBarrel { 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

- Public Attributes inherited from AMortarProPoolableActor
FMortarProActorActivated BeginActivation
 
FMortarProActorDeactivated BeginDeactivation
 
float DeactivateSpan = 10.f
 

Detailed Description

Projectile class Derived from MortarProBaseProjectile class. This class of projectile is for projectiles that are continous beam like a flame thrower or laser beam.

Constructor & Destructor Documentation

◆ AMortarProBeamProjectile()

AMortarProBeamProjectile::AMortarProBeamProjectile ( )

Member Function Documentation

◆ AimingComponentStopped()

void AMortarProBeamProjectile::AimingComponentStopped ( )
private

Callback function for aiming component stop firing. this will deactivate the current actor Also Calls beam end blueprint function

◆ AreMultipleHitsAllowed()

bool AMortarProBeamProjectile::AreMultipleHitsAllowed ( ) const

Gets Whether Multiple Hits are allowed by this projectile

Returns
bool Variable true if multiple hits allowed ,false otherwise

◆ BPBeamEnd()

void AMortarProBeamProjectile::BPBeamEnd ( )

Event Called when beam is ending .This is a blueprintImplementableEvent which has to be used in blueprint

◆ BPBeamPositionChanged()

void AMortarProBeamProjectile::BPBeamPositionChanged ( const FVector &  OutStarting,
const FVector &  OutEnding 
)

Event Called whenever beam Position is modified

Parameters
[out]OutStartingContaining Starting Point of Beam
[out]OutEndingContaining Ending Point of Beam

◆ BPBeamStart()

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

Parameters
[out]OutStartingContaining Starting Point of Beam
[out]OutEndingContaining Ending Point of Beam

◆ ClearTimers()

virtual void AMortarProBeamProjectile::ClearTimers ( )
overrideprotectedvirtual

Clears All Timers of the projectile. Also Called on deactivation

Reimplemented from AMortarProPoolableActor.

◆ DamageToActor()

void AMortarProBeamProjectile::DamageToActor ( FHitResult &  Result)
private

Damages actor that was hit by the box trace

◆ EnableComponents()

virtual void AMortarProBeamProjectile::EnableComponents ( const bool &  bEnable)
overrideprotectedvirtual

Enables/Disables All Components.This is also called when reactivating/deactivating actor for reusability

Parameters
[in]bEnableboolean flag true to Enable and false to Disable Components

Reimplemented from AMortarProPoolableActor.

◆ EnableDamageToTarget()

void AMortarProBeamProjectile::EnableDamageToTarget ( )
private

Callback function for enabling damage to target

◆ GetBeamMaxReachXOffset()

float AMortarProBeamProjectile::GetBeamMaxReachXOffset ( ) const

Gets the beam Maximum Reach. By default Beam Reaches target completely.

Returns
float variable containing Maximum Offset in X Direction

◆ GetDamageRate()

float AMortarProBeamProjectile::GetDamageRate ( ) const

Gets Rate by which we damage the target

Returns
Float Variable telling the damage rate

◆ GetInitialDelayBeforeDamage()

float AMortarProBeamProjectile::GetInitialDelayBeforeDamage ( ) const

Gets Initial Delay after which projectile candamage

Returns
Float Variable containing repel force

◆ GetLineTracesStartAndTarget()

void AMortarProBeamProjectile::GetLineTracesStartAndTarget ( TArray< TPair< FVector, FVector > > &  LinePoints,
const FVector &  StartPosition,
const FVector &  TargetPosition 
)
private

Does 5 Line traces . at each corner of box component and from middle

Parameters
[out]LinePointsTArray of TPair with Start and End Location
[in]StartPositionFVector representing start position of actor
[in]TargetPositionTarget Position to consider for trace

◆ GetUpdatedEndTargetPosition()

FVector AMortarProBeamProjectile::GetUpdatedEndTargetPosition ( const FVector &  StartPosition,
const FVector &  EndPosition 
)
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

Parameters
[in]StartPositionFVector containing Starting point of Beam
[in]EndPositionFVector containing End Point of Beam
Returns
FVector containing Updated End POsition

◆ InitializeBeforeSpawnParam()

void AMortarProBeamProjectile::InitializeBeforeSpawnParam ( )
overrideprotectedvirtual

Resets before spawning parameters

Reimplemented from AMortarProBaseProjectile.

◆ SetAfterSpawnParam()

virtual void AMortarProBeamProjectile::SetAfterSpawnParam ( const FMortarProAfterSpawnParam AfterSpawnParam)
overridevirtual

Initializes Projectile params

Parameters
[in]AfterSpawnParamParameters to set after spawning
See also
FMortarProAfterSpawnParam

Reimplemented from AMortarProBaseProjectile.

◆ SetBeamMaxReachXOffset()

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

Parameters
[in]XMaxReachfloat Variable X Offset;

◆ SetDamageRate()

void AMortarProBeamProjectile::SetDamageRate ( const float &  Rate)

Sets Rate by which we damage the target

Parameters
[in]Ratefloat Variable telling the damage rate

◆ SetInitialDelayBeforeDamage()

void AMortarProBeamProjectile::SetInitialDelayBeforeDamage ( const float &  InitialDelay)

Sets Initial Delay after which this projectile can damage

Parameters
[in]InitialDelayInitial Delay of Projectile

◆ SetLimitBeamMaxReach()

void AMortarProBeamProjectile::SetLimitBeamMaxReach ( const bool &  ShouldLimit)

Sets Whether we should limit the maximum Beam Reach in X Offset. By default beam reaches Target

Parameters
[in]ShouldLimitbool Variable true if the beam reach should be limited false otherwise

◆ SetMultipleHitsAllowed()

void AMortarProBeamProjectile::SetMultipleHitsAllowed ( const bool &  isAllowed)

Sets Whether multiple hits are allowed by this projectile like in example of flamethrower

Parameters
[in]isAllowedbool Variable true if multiple hits allowed false otherwise

◆ ShouldLimitBeamMaxReach()

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

Returns
bool variable true if we want to limit the max reach false otherwise

◆ Tick()

void AMortarProBeamProjectile::Tick ( float  DeltaTime)
override

In this tick we do box trace to hit target

Member Data Documentation

◆ Barrel

class UMortarProBarrelMeshComponent* AMortarProBeamProjectile::Barrel { nullptr }
private

Reference to Barrel

◆ BeamMaxReachXOffset

float AMortarProBeamProjectile::BeamMaxReachXOffset = 1000.f
private

Maximum Offset in X Direction the beam can reach. Only enabled in case where We limit the max reach

◆ BeamTraceReference

class UBoxComponent* AMortarProBeamProjectile::BeamTraceReference = nullptr
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

◆ bEnableDamageToTarget

uint32 AMortarProBeamProjectile::bEnableDamageToTarget
private

Flag telling whether to start box trace

◆ bEnableDebugBoxTrace

uint32 AMortarProBeamProjectile::bEnableDebugBoxTrace
private

Whether to Draw Debug line from starting position to target

◆ bEnableMultipleHits

uint32 AMortarProBeamProjectile::bEnableMultipleHits
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

◆ bLimitBeamMaxReachXOffset

uint32 AMortarProBeamProjectile::bLimitBeamMaxReachXOffset
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

◆ DamageRate

float AMortarProBeamProjectile::DamageRate = 0.2f
private

Rate by which damage will happen to the target actor

◆ GunBarrelRotation

FRotator AMortarProBeamProjectile::GunBarrelRotation
private

Rotation for Gun Barrel

◆ InitialDelayBeforeDamage

float AMortarProBeamProjectile::InitialDelayBeforeDamage = 0.2f
private

Initial Delay after which this projectile can damage

◆ InitialDelayTimerHandle

FTimerHandle AMortarProBeamProjectile::InitialDelayTimerHandle
private

Timer Handle for enabling Damage

◆ LastDamageTime

float AMortarProBeamProjectile::LastDamageTime = 0.f
private

Time at which we did damage to the actor

◆ LastStartPosition

FVector AMortarProBeamProjectile::LastStartPosition
private

Last Start Position of actor

◆ LastTargetPosition

FVector AMortarProBeamProjectile::LastTargetPosition
private

Last Hit Position of target

◆ NiagaraLaunchBlast

class UNiagaraSystem* AMortarProBeamProjectile::NiagaraLaunchBlast = nullptr
protected

Niagara System That will be emitted on Launch of this actor from Mortar Gun


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