|
Mortar Pro Plugin
Version 3
Modular Turret Plugin
|
#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< FMortarProBulletHellProjectileInstance > | BulletHellProjectileInstance |
| 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 |
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
| AMortarProBulletHellManager::AMortarProBulletHellManager | ( | ) |
|
overrideprotectedvirtual |
On Begin play Initializes all Meshes
| 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
| [in] | LaunchPositions | TArray of Vector containing the Launch Position of New projectiles |
| [in] | CurrentProjectiles | TArray of FMortarProBulletHellActiveInfo containing the Active INfo |
| [in] | ExplosionsStruct | TArray of FMortarProBulletHellExplosionInfo containing the Explosion Info |
| void AMortarProBulletHellManager::DeactivateProjectileInstance | ( | FMortarProBulletHellProjectileInstance & | ProjectileInstance, |
| bool | UpdateScene = false |
||
| ) |
Deactivates a particular Projectile Instance.Also Makes the index available for reuse
| [in] | ProjectileInstance | Type FMortarProBulletHellProjectileInstance Containing the particular Projectile instances |
| [in] | UpdateScene | Bool Variable which says whether to immediately update the screen or not. if not then user has to call make render dirty on the ISM |
| float AMortarProBulletHellManager::GetAcceleration | ( | ) | const |
Gets the acceleration of the projectile Instance.Not used in case of gravity
| bool AMortarProBulletHellManager::GetApplySway | ( | ) | const |
Gets whether sway is applied
| int32 AMortarProBulletHellManager::GetCollisionSphereRadius | ( | ) | const |
Gets the radius of the collision sphere
| float AMortarProBulletHellManager::GetDamageAsPerSurface | ( | const EPhysicalSurface & | SurfaceType | ) |
Gets Damage Per Surface Type.
| [in] | SurfaceType | Type of Surface that can be set in project settings |
| bool AMortarProBulletHellManager::GetEnableHoming | ( | ) | const |
Gets whether homing is enabled
| bool AMortarProBulletHellManager::GetEnableRoll | ( | ) | const |
Gets whether roll is enabled.If true it will role with a roll speed
| float AMortarProBulletHellManager::GetHomingDelay | ( | ) | const |
Gets the delay for homing
| float AMortarProBulletHellManager::GetHomingStrength | ( | ) | const |
Gets the strength of homing
| int32 AMortarProBulletHellManager::GetMaxBulletHellProjectiles | ( | ) | const |
Gets the maximum number of bullet hell projectiles that the manager can handle
| float AMortarProBulletHellManager::GetMaxLifeTime | ( | ) | const |
Gets the maximum lifetime of the projectile.After this the projectile deactivates without explosion
| float AMortarProBulletHellManager::GetMaxSpeed | ( | ) | const |
Gets the maximum speed of the projectile. In case of gravity this is not used
| float AMortarProBulletHellManager::GetProjectileGravityScale | ( | ) | const |
Getter Function To get Get Scale of Projectile in case of Gravity it will be greater than 0
| float AMortarProBulletHellManager::GetProjectileSpeed | ( | const int32 & | ProjectileInstance | ) | const |
Getter Function To get Get Projectile Speed of the Bullet Hell instance
| [in] | ProjectileInstance | Speed of specific Instance. Speed Can vary for every instance in case of Gravity |
| float AMortarProBulletHellManager::GetRollSpeed | ( | ) | const |
Gets the roll speed
| float AMortarProBulletHellManager::GetRotationCorrectionSpeed | ( | ) | const |
Gets the rotation correction speed
| bool AMortarProBulletHellManager::GetRotationFollowVelocity | ( | ) | const |
Gets whether rotation follows velocity
| FVector AMortarProBulletHellManager::GetSwayAmplitude | ( | ) | const |
Gets the amplitude i.e the distance of sway
| FVector AMortarProBulletHellManager::GetSwaySpeed | ( | ) | const |
Gets the speed of sway in X,Y,Z
| int32 AMortarProBulletHellManager::GetTotalActive | ( | ) |
Gets Total ACtive Projectile at current time
|
private |
Gets Updated Position Value for a particular Frame. Doesnt update the Position itself
| [in] | ProjectileInstance | Instance of projectile for which we calculate the udpated Position |
| [in] | DeltaTime | Frame Time |
|
private |
Gets Updated Rotation Value for a particular Frame. Doesnt update the rotation itself
| [in] | ProjectileInstance | Instance of projectile for which we calculate the Updated rotation |
| [in] | DeltaTime | Frame Time |
|
private |
Gets Updated Velocity Value for a particular Frame. Doesnt update the Velocity itself
| [in] | ProjectileInstance | Instance of projectile for which we calculate the updated Velocity |
| [in] | DeltaTime | Frame Time |
| void AMortarProBulletHellManager::SetAcceleration | ( | const float & | InAcceleration | ) |
Sets the acceleration of the projectile.Accelerates till max speed and only valid for non gravity based projectiles
| [in] | InAcceleration | Float value representing the acceleration |
| void AMortarProBulletHellManager::SetApplySway | ( | const bool & | InApplySway | ) |
Sets whether sway is applied while moving
| [in] | InApplySway | Boolean value indicating if sway should be applied |
| void AMortarProBulletHellManager::SetCollisionSphereRadius | ( | const int32 & | InCollisionSphereRadius | ) |
Sets the radius of the collision sphere
| [in] | InCollisionSphereRadius | Float value representing the radius of the collision sphere |
| void AMortarProBulletHellManager::SetEnableHoming | ( | const bool & | InEnableHoming | ) |
Sets whether homing Projectile is enabled
| [in] | InEnableHoming | Boolean value indicating if homing should be enabled |
| void AMortarProBulletHellManager::SetEnableRoll | ( | const bool & | InEnableRoll | ) |
Sets whether roll is enabled.
| [in] | InEnableRoll | Boolean value indicating if roll should be enabled |
| void AMortarProBulletHellManager::SetGlobalSpeed | ( | const float & | InSpeed | ) |
Sets Global Speed . In case of Gravity Global Speed is overriden with the calculate velocity by Aiming Component
| [in] | InSpeed | float Variable for setting Speed |
| void AMortarProBulletHellManager::SetHomingDelay | ( | const float & | InHomingDelay | ) |
Sets the delay for homing
| [in] | InHomingDelay | Float value representing the homing delay |
| void AMortarProBulletHellManager::SetHomingStrength | ( | const float & | InHomingStrength | ) |
Sets the strength of homing Missile if enable homing is on
| [in] | InHomingStrength | Float value representing the strength of homing |
| void AMortarProBulletHellManager::SetMaxBulletHellProjectiles | ( | const int32 & | InMaxBulletHellProjectiles | ) |
Sets the maximum number of bullet hell projectiles the manager can handle
| [in] | InMaxBulletHellProjectiles | Integer value representing the maximum number of projectiles |
| void AMortarProBulletHellManager::SetMaxLifeTime | ( | const float & | InMaxLifeTime | ) |
Sets the maximum lifetime of the projectile.After this the projectile deactivates
| [in] | InMaxLifeTime | Float value representing the maximum lifetime |
| void AMortarProBulletHellManager::SetMaxSpeed | ( | const float & | InMaxSpeed | ) |
Sets the maximum speed the projectile can accelerate upto. Cannot be used with gravity
| [in] | InMaxSpeed | Float value representing the maximum speed |
| void AMortarProBulletHellManager::SetProjectileGravityScale | ( | const float & | InGravity | ) |
Sets Projectile Gravity Scale
| [in] | InGravity | Float Variable |
| void AMortarProBulletHellManager::SetRollSpeed | ( | const float & | InRollSpeed | ) |
Sets the roll speed of the projectile while it moves.
| [in] | InRollSpeed | Float value representing the roll speed |
| void AMortarProBulletHellManager::SetRotationCorrectionSpeed | ( | const float & | InRotationCorrectionSpeed | ) |
Sets the rotation correction speed it uses to align towards velocity
| [in] | InRotationCorrectionSpeed | Float value representing the rotation correction speed |
| void AMortarProBulletHellManager::SetRotationFollowVelocity | ( | const bool & | InRotationFollowVelocity | ) |
Sets whether rotation follows velocity
| [in] | InRotationFollowVelocity | Boolean value indicating if rotation should follow velocity |
| void AMortarProBulletHellManager::SetSwayAmplitude | ( | const FVector & | InSwayAmplitude | ) |
Sets the amplitude of sway
| [in] | InSwayAmplitude | FVector value representing the amplitude of sway |
| void AMortarProBulletHellManager::SetSwaySpeed | ( | const FVector & | InSwaySpeed | ) |
Sets the speed of sway in X,Y,Z
| [in] | InSwaySpeed | FVector value representing the speed of sway |
| 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
| [in] | SpawnPos | FVector telling where to spawn |
| [in] | Direction | FVector telling the direction of the spawned instance |
| [in] | TargetActor | Target Actor to focus on. Used in case of Homing |
| [in] | Owner | AActor owning the projectiles |
| [in] | ConsiderGravity | Whether the gravity was used while calculating Hit Direction.By Default False |
| [in] | Velocity | Used instance wise when ConsiderGravity is true.Default Zero Vector |
|
overrideprotectedvirtual |
Tick FUnction Updating Projectile instance position and does collision check It loops through ActiveProjectilesIndex only
|
private |
Acceleration with which projectile instance is accelerated
|
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
|
private |
Apply Sway Effect to movement
|
private |
Whether to Draw Debug line for a projectile instance
|
private |
Whether to Enable Gravity
|
private |
Whether to Enable Homing Projectiles. Not works with gravity
|
private |
Enable/Disable Roll Rotation of Projectile
|
private |
Whether Rotation Follows VElocity Direction
|
private |
Array of Bullet Hell Instances
|
private |
ISM Template mesh for Projectile Instance
|
private |
Collision Sphere Radius.This is the radius of the collision sphere it uses while doing line trace for collision
|
private |
Damage As Per Surface for a Projectile Instance
|
private |
Trace Time For Drawing
|
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
|
private |
Whether to use Gravity 0 means no gravity > 0 means gravity will be used Clamed Min Value to 0
|
private |
Initial Delay After which the Projectile starts following the target Clamped Min to 0
|
private |
Homing Strength to use while following the target. Clamped Min to 0
|
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
|
private |
The Maximum Number of Projectile instance that can be present in a level
|
private |
Maximum Life in seconds till the projectile will remain alive
|
private |
Bullet Hell Max Projectile Speed
|
private |
Original Scale of the Mesh
|
private |
Roll Speed of the Projectile
|
private |
The Interp Speed * Deltatime at which the projectile rotation will corrected based on velocity
|
private |
Amplitude of Sway.Direction Max it can move
|
private |
Speed of Sway Movement in X,Y,Z direction
|
private |
Collision Channel for Trace while doing collision Check