Mortar Pro Plugin  Version 3
Modular Turret Plugin
Loading...
Searching...
No Matches
AMortarProBulletHellManager Class Reference

#include <MortarProBulletHellManager.h>

+ Inheritance diagram for AMortarProBulletHellManager:
+ Collaboration diagram for AMortarProBulletHellManager:

Public Member Functions

 AMortarProBulletHellManager ()
 
void BPProjectileStateUpdate (const TArray< FVector > &LaunchPositions, const TArray< FMortarProBulletHellActiveInfo > &CurrentProjectiles, const TArray< FMortarProBulletHellExplosionInfo > &ExplosionsStruct)
 
void DeactivateProjectileInstance (FMortarProBulletHellProjectileInstance &ProjectileInstance, bool UpdateScene=false)
 
float GetAcceleration () const
 
bool GetApplySway () const
 
int32 GetCollisionSphereRadius () const
 
float GetDamageAsPerSurface (const EPhysicalSurface &SurfaceType)
 
bool GetEnableHoming () const
 
bool GetEnableRoll () const
 
float GetHomingDelay () const
 
float GetHomingStrength () const
 
int32 GetMaxBulletHellProjectiles () const
 
float GetMaxLifeTime () const
 
float GetMaxSpeed () const
 
float GetProjectileGravityScale () const
 
float GetProjectileSpeed (const int32 &ProjectileInstance) const
 
float GetRollSpeed () const
 
float GetRotationCorrectionSpeed () const
 
bool GetRotationFollowVelocity () const
 
FVector GetSwayAmplitude () const
 
FVector GetSwaySpeed () const
 
int32 GetTotalActive ()
 
void SetAcceleration (const float &InAcceleration)
 
void SetApplySway (const bool &InApplySway)
 
void SetCollisionSphereRadius (const int32 &InCollisionSphereRadius)
 
void SetEnableHoming (const bool &InEnableHoming)
 
void SetEnableRoll (const bool &InEnableRoll)
 
void SetGlobalSpeed (const float &InSpeed)
 
void SetHomingDelay (const float &InHomingDelay)
 
void SetHomingStrength (const float &InHomingStrength)
 
void SetMaxBulletHellProjectiles (const int32 &InMaxBulletHellProjectiles)
 
void SetMaxLifeTime (const float &InMaxLifeTime)
 
void SetMaxSpeed (const float &InMaxSpeed)
 
void SetProjectileGravityScale (const float &InGravity)
 
void SetRollSpeed (const float &InRollSpeed)
 
void SetRotationCorrectionSpeed (const float &InRotationCorrectionSpeed)
 
void SetRotationFollowVelocity (const bool &InRotationFollowVelocity)
 
void SetSwayAmplitude (const FVector &InSwayAmplitude)
 
void SetSwaySpeed (const FVector &InSwaySpeed)
 
int SpawnBulletHellProjectileInstance (const FVector &SpawnPos, const FVector &Direction, TWeakObjectPtr< AActor > TargetActor, TWeakObjectPtr< AActor > Owner, bool ConsiderGravity=false, FVector Velocity=FVector::ZeroVector)
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void Tick (float DeltaTime) override
 

Private Member Functions

FVector GetUpdatedPosition (FMortarProBulletHellProjectileInstance &ProjectileInstance, float DeltaTime)
 
FQuat GetUpdatedRotation (FMortarProBulletHellProjectileInstance &ProjectileInstance, float DeltaTime)
 
FVector GetUpdatedVelocity (FMortarProBulletHellProjectileInstance &ProjectileInstance, float DeltaTime)
 

Private Attributes

float Acceleration = 2000
 
TSet< int32 > ActiveProjectilesIndex
 
uint32 bApplySway: 1
 
uint32 bEnableDebugBoxTrace: 1
 
uint32 bEnableGravity: 1
 
uint32 bEnableHoming: 1
 
uint32 bEnableRoll: 1
 
uint32 bRotationFollowVelocity: 1
 
TArray< FMortarProBulletHellProjectileInstanceBulletHellProjectileInstance
 
class UInstancedStaticMeshComponent * BulletHellProjectileMeshTemplate
 
int32 CollisionSphereRadius = 30
 
TMap< TEnumAsByte< EPhysicalSurface >, float > DamageAsPerSurface
 
float DebugTraceTime = 1.f
 
float GlobalSpeed = 1000
 
float GravityScale
 
float HomingDelay
 
float HomingStrength
 
TSet< int32 > InActiveProjectilesIndex
 
int32 MaxBulletHellProjectiles = 2000
 
float MaxLifeTime = 10.f
 
float MaxSpeed = 1000
 
FVector OriginalScale
 
float RollSpeed = 100
 
float RotationCorrectionSpeed = 5.f
 
FVector SwayAmplitude = FVector(10, 7, 5)
 
FVector SwaySpeed = FVector(0, 0, 0)
 
TEnumAsByte< ECollisionChannel > TraceChannel = ECC_Camera
 

Detailed Description

child class of Actor Base Class For Lightweight Projectiles with features for Normal,Homing and gravity Based Projectiles with inbuilt pooling mechanism. This class acts as a manager class and keeps projectile details in struct and updates them accordingly.Uses ISM for Projectiles. Highly Performant than normal projectiles should be preferred. Cannot Be used with Beam Aiming Component.Collision Via Sweep

Constructor & Destructor Documentation

◆ AMortarProBulletHellManager()

AMortarProBulletHellManager::AMortarProBulletHellManager ( )

Member Function Documentation

◆ BeginPlay()

virtual void AMortarProBulletHellManager::BeginPlay ( )
overrideprotectedvirtual

On Begin play Initializes all Meshes

◆ BPProjectileStateUpdate()

void AMortarProBulletHellManager::BPProjectileStateUpdate ( const TArray< FVector > &  LaunchPositions,
const TArray< FMortarProBulletHellActiveInfo > &  CurrentProjectiles,
const TArray< FMortarProBulletHellExplosionInfo > &  ExplosionsStruct 
)

Blueprint Function containing the position of active projectile. LaunchPositions TArray of Vector containing the Launch Position of New projectiles which then turn to active CurrentProjectiles TArray of FMortarProBulletHellActiveInfo containing the Active INfo ExplosionsStruct TArray of FMortarProBulletHellExplosionInfo containing the Explosion Info

Parameters
[in]LaunchPositionsTArray of Vector containing the Launch Position of New projectiles
[in]CurrentProjectilesTArray of FMortarProBulletHellActiveInfo containing the Active INfo
[in]ExplosionsStructTArray of FMortarProBulletHellExplosionInfo containing the Explosion Info

◆ DeactivateProjectileInstance()

void AMortarProBulletHellManager::DeactivateProjectileInstance ( FMortarProBulletHellProjectileInstance ProjectileInstance,
bool  UpdateScene = false 
)

Deactivates a particular Projectile Instance.Also Makes the index available for reuse

Parameters
[in]ProjectileInstanceType FMortarProBulletHellProjectileInstance Containing the particular Projectile instances
[in]UpdateSceneBool Variable which says whether to immediately update the screen or not. if not then user has to call make render dirty on the ISM

◆ GetAcceleration()

float AMortarProBulletHellManager::GetAcceleration ( ) const

Gets the acceleration of the projectile Instance.Not used in case of gravity

Returns
Float value representing the acceleration

◆ GetApplySway()

bool AMortarProBulletHellManager::GetApplySway ( ) const

Gets whether sway is applied

Returns
Boolean value indicating if sway is applied

◆ GetCollisionSphereRadius()

int32 AMortarProBulletHellManager::GetCollisionSphereRadius ( ) const

Gets the radius of the collision sphere

Returns
int32 value representing the radius of the collision sphere

◆ GetDamageAsPerSurface()

float AMortarProBulletHellManager::GetDamageAsPerSurface ( const EPhysicalSurface &  SurfaceType)

Gets Damage Per Surface Type.

Parameters
[in]SurfaceTypeType of Surface that can be set in project settings
Returns
float variable returning Damage

◆ GetEnableHoming()

bool AMortarProBulletHellManager::GetEnableHoming ( ) const

Gets whether homing is enabled

Returns
Boolean value indicating if homing is enabled

◆ GetEnableRoll()

bool AMortarProBulletHellManager::GetEnableRoll ( ) const

Gets whether roll is enabled.If true it will role with a roll speed

Returns
Boolean value indicating if roll is enabled.

◆ GetHomingDelay()

float AMortarProBulletHellManager::GetHomingDelay ( ) const

Gets the delay for homing

Returns
Float value representing the homing delay

◆ GetHomingStrength()

float AMortarProBulletHellManager::GetHomingStrength ( ) const

Gets the strength of homing

Returns
Float value representing the strength of homing

◆ GetMaxBulletHellProjectiles()

int32 AMortarProBulletHellManager::GetMaxBulletHellProjectiles ( ) const

Gets the maximum number of bullet hell projectiles that the manager can handle

Returns
Integer value representing the maximum number of projectiles

◆ GetMaxLifeTime()

float AMortarProBulletHellManager::GetMaxLifeTime ( ) const

Gets the maximum lifetime of the projectile.After this the projectile deactivates without explosion

Returns
Float value representing the maximum lifetime

◆ GetMaxSpeed()

float AMortarProBulletHellManager::GetMaxSpeed ( ) const

Gets the maximum speed of the projectile. In case of gravity this is not used

Returns
Float value representing the maximum speed

◆ GetProjectileGravityScale()

float AMortarProBulletHellManager::GetProjectileGravityScale ( ) const

Getter Function To get Get Scale of Projectile in case of Gravity it will be greater than 0

Returns
Projectile Gravity as Float

◆ GetProjectileSpeed()

float AMortarProBulletHellManager::GetProjectileSpeed ( const int32 &  ProjectileInstance) const

Getter Function To get Get Projectile Speed of the Bullet Hell instance

Parameters
[in]ProjectileInstanceSpeed of specific Instance. Speed Can vary for every instance in case of Gravity
Returns
Projectile Speed as float

◆ GetRollSpeed()

float AMortarProBulletHellManager::GetRollSpeed ( ) const

Gets the roll speed

Returns
Float value representing the roll speed

◆ GetRotationCorrectionSpeed()

float AMortarProBulletHellManager::GetRotationCorrectionSpeed ( ) const

Gets the rotation correction speed

Returns
Float value representing the rotation correction speed

◆ GetRotationFollowVelocity()

bool AMortarProBulletHellManager::GetRotationFollowVelocity ( ) const

Gets whether rotation follows velocity

Returns
Boolean value indicating if rotation follows velocity of the projectile

◆ GetSwayAmplitude()

FVector AMortarProBulletHellManager::GetSwayAmplitude ( ) const

Gets the amplitude i.e the distance of sway

Returns
FVector value representing the amplitude of sway

◆ GetSwaySpeed()

FVector AMortarProBulletHellManager::GetSwaySpeed ( ) const

Gets the speed of sway in X,Y,Z

Returns
FVector value representing the speed of sway

◆ GetTotalActive()

int32 AMortarProBulletHellManager::GetTotalActive ( )

Gets Total ACtive Projectile at current time

Returns
int variable Containing Total Active Projectiles

◆ GetUpdatedPosition()

FVector AMortarProBulletHellManager::GetUpdatedPosition ( FMortarProBulletHellProjectileInstance ProjectileInstance,
float  DeltaTime 
)
private

Gets Updated Position Value for a particular Frame. Doesnt update the Position itself

Parameters
[in]ProjectileInstanceInstance of projectile for which we calculate the udpated Position
[in]DeltaTimeFrame Time
Returns
FVector Containing New Value

◆ GetUpdatedRotation()

FQuat AMortarProBulletHellManager::GetUpdatedRotation ( FMortarProBulletHellProjectileInstance ProjectileInstance,
float  DeltaTime 
)
private

Gets Updated Rotation Value for a particular Frame. Doesnt update the rotation itself

Parameters
[in]ProjectileInstanceInstance of projectile for which we calculate the Updated rotation
[in]DeltaTimeFrame Time
Returns
FQuat Containing New Value

◆ GetUpdatedVelocity()

FVector AMortarProBulletHellManager::GetUpdatedVelocity ( FMortarProBulletHellProjectileInstance ProjectileInstance,
float  DeltaTime 
)
private

Gets Updated Velocity Value for a particular Frame. Doesnt update the Velocity itself

Parameters
[in]ProjectileInstanceInstance of projectile for which we calculate the updated Velocity
[in]DeltaTimeFrame Time
Returns
FVector Containing New Value

◆ SetAcceleration()

void AMortarProBulletHellManager::SetAcceleration ( const float &  InAcceleration)

Sets the acceleration of the projectile.Accelerates till max speed and only valid for non gravity based projectiles

Parameters
[in]InAccelerationFloat value representing the acceleration

◆ SetApplySway()

void AMortarProBulletHellManager::SetApplySway ( const bool &  InApplySway)

Sets whether sway is applied while moving

Parameters
[in]InApplySwayBoolean value indicating if sway should be applied

◆ SetCollisionSphereRadius()

void AMortarProBulletHellManager::SetCollisionSphereRadius ( const int32 &  InCollisionSphereRadius)

Sets the radius of the collision sphere

Parameters
[in]InCollisionSphereRadiusFloat value representing the radius of the collision sphere

◆ SetEnableHoming()

void AMortarProBulletHellManager::SetEnableHoming ( const bool &  InEnableHoming)

Sets whether homing Projectile is enabled

Parameters
[in]InEnableHomingBoolean value indicating if homing should be enabled

◆ SetEnableRoll()

void AMortarProBulletHellManager::SetEnableRoll ( const bool &  InEnableRoll)

Sets whether roll is enabled.

Parameters
[in]InEnableRollBoolean value indicating if roll should be enabled

◆ SetGlobalSpeed()

void AMortarProBulletHellManager::SetGlobalSpeed ( const float &  InSpeed)

Sets Global Speed . In case of Gravity Global Speed is overriden with the calculate velocity by Aiming Component

Parameters
[in]InSpeedfloat Variable for setting Speed

◆ SetHomingDelay()

void AMortarProBulletHellManager::SetHomingDelay ( const float &  InHomingDelay)

Sets the delay for homing

Parameters
[in]InHomingDelayFloat value representing the homing delay

◆ SetHomingStrength()

void AMortarProBulletHellManager::SetHomingStrength ( const float &  InHomingStrength)

Sets the strength of homing Missile if enable homing is on

Parameters
[in]InHomingStrengthFloat value representing the strength of homing

◆ SetMaxBulletHellProjectiles()

void AMortarProBulletHellManager::SetMaxBulletHellProjectiles ( const int32 &  InMaxBulletHellProjectiles)

Sets the maximum number of bullet hell projectiles the manager can handle

Parameters
[in]InMaxBulletHellProjectilesInteger value representing the maximum number of projectiles

◆ SetMaxLifeTime()

void AMortarProBulletHellManager::SetMaxLifeTime ( const float &  InMaxLifeTime)

Sets the maximum lifetime of the projectile.After this the projectile deactivates

Parameters
[in]InMaxLifeTimeFloat value representing the maximum lifetime

◆ SetMaxSpeed()

void AMortarProBulletHellManager::SetMaxSpeed ( const float &  InMaxSpeed)

Sets the maximum speed the projectile can accelerate upto. Cannot be used with gravity

Parameters
[in]InMaxSpeedFloat value representing the maximum speed

◆ SetProjectileGravityScale()

void AMortarProBulletHellManager::SetProjectileGravityScale ( const float &  InGravity)

Sets Projectile Gravity Scale

Parameters
[in]InGravityFloat Variable

◆ SetRollSpeed()

void AMortarProBulletHellManager::SetRollSpeed ( const float &  InRollSpeed)

Sets the roll speed of the projectile while it moves.

Parameters
[in]InRollSpeedFloat value representing the roll speed

◆ SetRotationCorrectionSpeed()

void AMortarProBulletHellManager::SetRotationCorrectionSpeed ( const float &  InRotationCorrectionSpeed)

Sets the rotation correction speed it uses to align towards velocity

Parameters
[in]InRotationCorrectionSpeedFloat value representing the rotation correction speed

◆ SetRotationFollowVelocity()

void AMortarProBulletHellManager::SetRotationFollowVelocity ( const bool &  InRotationFollowVelocity)

Sets whether rotation follows velocity

Parameters
[in]InRotationFollowVelocityBoolean value indicating if rotation should follow velocity

◆ SetSwayAmplitude()

void AMortarProBulletHellManager::SetSwayAmplitude ( const FVector &  InSwayAmplitude)

Sets the amplitude of sway

Parameters
[in]InSwayAmplitudeFVector value representing the amplitude of sway

◆ SetSwaySpeed()

void AMortarProBulletHellManager::SetSwaySpeed ( const FVector &  InSwaySpeed)

Sets the speed of sway in X,Y,Z

Parameters
[in]InSwaySpeedFVector value representing the speed of sway

◆ SpawnBulletHellProjectileInstance()

int AMortarProBulletHellManager::SpawnBulletHellProjectileInstance ( const FVector &  SpawnPos,
const FVector &  Direction,
TWeakObjectPtr< AActor >  TargetActor,
TWeakObjectPtr< AActor >  Owner,
bool  ConsiderGravity = false,
FVector  Velocity = FVector::ZeroVector 
)

Called From aiming Component for spawning a bullet hell instance It Picks the first inactive index Makes Projectile instance active and sets all the parameters passed For Gravity it uses velocity as it varies instance wise which set by Aiming Component while spawning for no gravity the speed is set by the global speed variable in the manager

Parameters
[in]SpawnPosFVector telling where to spawn
[in]DirectionFVector telling the direction of the spawned instance
[in]TargetActorTarget Actor to focus on. Used in case of Homing
[in]OwnerAActor owning the projectiles
[in]ConsiderGravityWhether the gravity was used while calculating Hit Direction.By Default False
[in]VelocityUsed instance wise when ConsiderGravity is true.Default Zero Vector
Returns
Visual Instance ID of The Projectile Spawned

◆ Tick()

virtual void AMortarProBulletHellManager::Tick ( float  DeltaTime)
overrideprotectedvirtual

Tick FUnction Updating Projectile instance position and does collision check It loops through ActiveProjectilesIndex only

Member Data Documentation

◆ Acceleration

float AMortarProBulletHellManager::Acceleration = 2000
private

Acceleration with which projectile instance is accelerated

◆ ActiveProjectilesIndex

TSet<int32> AMortarProBulletHellManager::ActiveProjectilesIndex
private

Stores the index of Active Projectiles. In Tick we loop through these indices only for updating position Initially it is empty. When the projectile is spawned entry is made in it and when deactivated Entry is removed

◆ bApplySway

uint32 AMortarProBulletHellManager::bApplySway
private

Apply Sway Effect to movement

◆ bEnableDebugBoxTrace

uint32 AMortarProBulletHellManager::bEnableDebugBoxTrace
private

Whether to Draw Debug line for a projectile instance

◆ bEnableGravity

uint32 AMortarProBulletHellManager::bEnableGravity
private

Whether to Enable Gravity

◆ bEnableHoming

uint32 AMortarProBulletHellManager::bEnableHoming
private

Whether to Enable Homing Projectiles. Not works with gravity

◆ bEnableRoll

uint32 AMortarProBulletHellManager::bEnableRoll
private

Enable/Disable Roll Rotation of Projectile

◆ bRotationFollowVelocity

uint32 AMortarProBulletHellManager::bRotationFollowVelocity
private

Whether Rotation Follows VElocity Direction

◆ BulletHellProjectileInstance

TArray<FMortarProBulletHellProjectileInstance> AMortarProBulletHellManager::BulletHellProjectileInstance
private

Array of Bullet Hell Instances

◆ BulletHellProjectileMeshTemplate

class UInstancedStaticMeshComponent* AMortarProBulletHellManager::BulletHellProjectileMeshTemplate
private

ISM Template mesh for Projectile Instance

◆ CollisionSphereRadius

int32 AMortarProBulletHellManager::CollisionSphereRadius = 30
private

Collision Sphere Radius.This is the radius of the collision sphere it uses while doing line trace for collision

◆ DamageAsPerSurface

TMap<TEnumAsByte<EPhysicalSurface>, float> AMortarProBulletHellManager::DamageAsPerSurface
private

Damage As Per Surface for a Projectile Instance

◆ DebugTraceTime

float AMortarProBulletHellManager::DebugTraceTime = 1.f
private

Trace Time For Drawing

◆ GlobalSpeed

float AMortarProBulletHellManager::GlobalSpeed = 1000
private

Bullet Hell Projectile Global Speed. In case of Gravity The Speed Value is Disabled as the aiming component sets speed from outside as it can vary for instance to instance In case of Gravity Global Speed is overriden with the calculate velocity by Aiming Component

◆ GravityScale

float AMortarProBulletHellManager::GravityScale
private

Whether to use Gravity 0 means no gravity > 0 means gravity will be used Clamed Min Value to 0

◆ HomingDelay

float AMortarProBulletHellManager::HomingDelay
private

Initial Delay After which the Projectile starts following the target Clamped Min to 0

◆ HomingStrength

float AMortarProBulletHellManager::HomingStrength
private

Homing Strength to use while following the target. Clamped Min to 0

◆ InActiveProjectilesIndex

TSet<int32> AMortarProBulletHellManager::InActiveProjectilesIndex
private

Stores The INdex of inactive Projectiles. SO initially it is storing all the index When Projectile spawn then the entry is remeoved and when the projectile is deactivated Element is inserted in this

◆ MaxBulletHellProjectiles

int32 AMortarProBulletHellManager::MaxBulletHellProjectiles = 2000
private

The Maximum Number of Projectile instance that can be present in a level

◆ MaxLifeTime

float AMortarProBulletHellManager::MaxLifeTime = 10.f
private

Maximum Life in seconds till the projectile will remain alive

◆ MaxSpeed

float AMortarProBulletHellManager::MaxSpeed = 1000
private

Bullet Hell Max Projectile Speed

◆ OriginalScale

FVector AMortarProBulletHellManager::OriginalScale
private

Original Scale of the Mesh

◆ RollSpeed

float AMortarProBulletHellManager::RollSpeed = 100
private

Roll Speed of the Projectile

◆ RotationCorrectionSpeed

float AMortarProBulletHellManager::RotationCorrectionSpeed = 5.f
private

The Interp Speed * Deltatime at which the projectile rotation will corrected based on velocity

◆ SwayAmplitude

FVector AMortarProBulletHellManager::SwayAmplitude = FVector(10, 7, 5)
private

Amplitude of Sway.Direction Max it can move

◆ SwaySpeed

FVector AMortarProBulletHellManager::SwaySpeed = FVector(0, 0, 0)
private

Speed of Sway Movement in X,Y,Z direction

◆ TraceChannel

TEnumAsByte<ECollisionChannel> AMortarProBulletHellManager::TraceChannel = ECC_Camera
private

Collision Channel for Trace while doing collision Check


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