![]() |
Mortar Pro Plugin
Version 2
Modular Turret Plugin
|
#include <MortarProPhysicalProjectile.h>
Public Member Functions | |
AMortarProPhysicalProjectile () | |
bool | GetDynamicDeactivateSpan () const |
float | GetInitialHomingTargetDelayPercent () const |
void | GetMinMaxHomingAcceleration (double &OutMinAcceleration, double &OutMaxAcceleration) const |
float | GetProjectileSpeed () |
virtual void | SetAfterSpawnParam (const FMortarProAfterSpawnParam &AfterSpawnParam) override |
void | SetDynamicDeactivateSpan (const bool &bIsDynamic) |
void | SetInitialHomingTargetDelayPercent (const float &DelayPercent) |
void | SetMinMaxHomingAcceleration (const double &MinAcceleration, const double &MaxAcceleration) |
![]() | |
void | BPOnImpactEvent () |
virtual float | GetProjectileSpeed () |
virtual void | SetAfterSpawnParam (const FMortarProAfterSpawnParam &AfterSpawnParam) |
![]() | |
AMortarProPoolableActor () | |
virtual void | DeActivateActor () |
virtual void | ReActivateActor () |
virtual void | SetDeactivateSpan (const float &Time) |
Public Attributes | |
TMap< EMortarProSignificanceValue, float > | SignifianceValue |
![]() | |
FMortarProActorActivated | BeginActivation |
FMortarProActorDeactivated | BeginDeactivation |
float | DeactivateSpan = 10.f |
Protected Member Functions | |
virtual void | BeginPlay () override |
virtual void | ClearTimers () override |
virtual void | EnableComponents (const bool &bEnable) override |
virtual void | InitializeBeforeSpawnParam () override |
virtual void | OnHit (UPrimitiveComponent *HitComponent, AActor *OtherActor, UPrimitiveComponent *OtherComponent, FVector NormalImpulse, const FHitResult &Hit) |
virtual void | RegisterEventsAndCallBacks () |
![]() | |
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 | |
float | AvgProjectileSpeed = 0.f |
uint32 | bAlreadyHit: 1 |
uint32 | bDynamicDeactivateSpan: 1 |
float | BufferDeactivateSpan = 2.f |
UStaticMeshComponent * | CollisionMesh = nullptr |
ECollisionEnabled::Type | CollisionMeshCollision |
float | DeactivateDelayAfterDamage = 0.1f |
class URadialForceComponent * | ExplosionForce = nullptr |
float | InitialHomingTargetDelayPercent = 0.0f |
double | MaxHomingAcceleration = 0 |
double | MinHomingAcceleration = 0 |
class UNiagaraSystem * | NiagaraLaunchBlast = nullptr |
class UNiagaraComponent * | NiagaraTrail = nullptr |
class UMortarProProjectileMovement * | ProjectileMovement = nullptr |
class UMortarProSignificanceComponent * | SignificanceComponent {nullptr} |
class UCurveFloat * | VariableSpeedCurve { 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 | InitializeAverageSpeedAfterSpawn () |
void | InitializeDynamicDeactivateTimeAfterSpawn () |
void | InitializeHomingTargetAfterSpawn () |
void | InitializeVariableSpeedAfterSpawn () |
void | SetHomingTargetTimerFunction () |
void | SignificanceChanged (EMortarProSignificanceValue Value) |
void | SpeedTimeLineProgress (float Speed) |
void | TimelineUpdate () |
Private Attributes | |
FTimerHandle | AfterDamageDeactivaterHandle |
float | TickTimelineRate = 0.1f |
FTimeline | TimelineSpeed |
FTimerHandle | TimeLineUpdateTimer |
Base class for Physical Projectiles Derived from AMortarProBaseProjectile class.Includes all the logic of projectile launching damaging etc Niagara effects can be set here including trail effect,hit impact for each surface,launch effect as well as sound. Homing Missile setting can be set here. Variable speed can also be set here. It is a physical based projectile based on float curve
AMortarProPhysicalProjectile::AMortarProPhysicalProjectile | ( | ) |
Sets default values for this actor's properties
|
overrideprotectedvirtual |
Called when the game starts or when spawned
Reimplemented from AMortarProPoolableActor.
|
overrideprotectedvirtual |
Clears All Timers of the projectile. Also Called on deactivation
Reimplemented from AMortarProPoolableActor.
Reimplemented in AMortarProMineProjectile, and AMortarProSplitProjectile.
|
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.
bool AMortarProPhysicalProjectile::GetDynamicDeactivateSpan | ( | ) | const |
Returns True if Deactivate time of particle is dynamic,false otherwise
float AMortarProPhysicalProjectile::GetInitialHomingTargetDelayPercent | ( | ) | const |
Returns Percentage which represents the delay after which we set homing target component. This percentage is with respect to total time taken to hit a target. If it 100 percent then we set homing target when the projectile has reached target and if it 0 percent then we set homing target as soon as the projectile is spawned.
void AMortarProPhysicalProjectile::GetMinMaxHomingAcceleration | ( | double & | OutMinAcceleration, |
double & | OutMaxAcceleration | ||
) | const |
Returns Minimum and Maximum Homing Acceleration
[out] | OutMinAcceleration | Minimum Homing Acceleration |
[out] | OutMaxAcceleration | Maximum Homing Acceleration |
|
virtual |
Gets Projectile Speed
Reimplemented from AMortarProBaseProjectile.
|
private |
Sets Average Speed of Projectile. In case of constant speed/velocity it is equal to InitialSpeed and Velocity respectively. In Case of Variable Speed it is equal to (max speed set in curve + min speed set in curve) /2
|
overrideprotectedvirtual |
Initializes All local Parameter before spawning. This is also called when reactivating actor for reusability
Reimplemented from AMortarProBaseProjectile.
Reimplemented in AMortarProMineProjectile, and AMortarProSplitProjectile.
|
private |
Initialize Dynamic Deactivation based on time taken to hit the target.
|
private |
Initialize Homing Target to the target actor set
|
private |
Initialize Variable Speed Timer after spawning
|
protectedvirtual |
On Every Collision of Projectile This Function will be called.This is Called on ComponentHit Function of Collision Mesh of Projectile Mesh.
Reimplemented in AMortarProMineProjectile.
|
protectedvirtual |
Register ANy Call Backs. This is basically Done once. Called in Begin Play
|
overridevirtual |
Initializes Projectile params
[in] | AfterSpawnParam | Parameters to set after spawning |
Reimplemented from AMortarProBaseProjectile.
Reimplemented in AMortarProSplitProjectile.
void AMortarProPhysicalProjectile::SetDynamicDeactivateSpan | ( | const bool & | bIsDynamic | ) |
Sets whether Deactivate Time is dynamic
[in] | bIsDynamic | Boolean Value where true means the deativate time of particle is dynamic ,false otherwise |
|
private |
Sets Homing Target and acceleration. Called as a callback to timer
void AMortarProPhysicalProjectile::SetInitialHomingTargetDelayPercent | ( | const float & | DelayPercent | ) |
Sets Percentage Delay For Setting Homing Target Component
[in] | DelayPercent | Percentage between 0 and 100 |
void AMortarProPhysicalProjectile::SetMinMaxHomingAcceleration | ( | const double & | MinAcceleration, |
const double & | MaxAcceleration | ||
) |
Sets Minimum and Maximum Homing Acceleration to have some randomness
[in] | MinAcceleration | Minimum Homing acceleration |
[in] | MaxAcceleration | Maximum Homing acceleration |
|
private |
Significance Changed Callback . Called whenever significance Value is changed
|
private |
Progress function called on time line updation for speed of projectile param[in] Speed float Variable containing updated Speed
|
private |
Update Time line with a rate of TickTimelineRate. Not doing in tick Since Tick won't be required after timeline ends
|
private |
Handle for after Hit projectile Deactivation Handle
|
protected |
Avg Speed oF projectile. In case of variable speed it is (minSpeed + maxSpeed)/2 and in case it is not a variable speed it is just simply equal to max value of projectile
|
protected |
|
protected |
Whether the Deactivate time of particle is dynamic. The life is calculated based on time to target. plus some additional time in second
|
protected |
Buffer Deactivate span time in seconds to be added to deativate span of actor. This Is Activated only When We set Dynamic Deactivate Span for the projectile
|
protected |
Mesh of projectile Which will enable collision event
|
protected |
Collision Type of Collision Mesh
|
protected |
Time after which projectiles will be deactivated after impact or explosion in case of Mine Projectile.
|
protected |
This is impulse Force x change in time see wikipedia
|
protected |
It if is 100 percent then it means we set homing target component when the projectile has reached its target that it is 100 percent of total time taken to hit the target. If it is 0 then it means it is 0 of the total time taken to hit the target i.e at 0th second we set Homing Component. We call timer for setting homing target based on the time we calculated here.
|
protected |
Max acceleration with which homing missile acceleration is set Homing Acceleration Magnitude lies between min and max homing acceleration
|
protected |
Minimum acceleration with which homing missile acceleration is set Homing Acceleration Magnitude lies between min and max homing acceleration
|
protected |
Particle System That will be emitted on Launch from Mortar Gun
|
protected |
Niagara System That will be used on the Projectile Mesh like Smoke Trail etc
|
protected |
Projectile Movement For Movement of Projectile We are using Custom Projectile MOvement which basically ticks in aggregate manner we register tick of projectile movement component for all projectile actors and tick using MortarProAggregateTickSubsystem
TMap<EMortarProSignificanceValue,float> AMortarProPhysicalProjectile::SignifianceValue |
Represents The tick rate for the significance Value Mentioned Key is EMortarProSignificanceValue and value is tick rate
|
protected |
Significance Component which controls the tick rate of the projectile movement
|
private |
Timer Rate for Updating Timeline
|
private |
Time line for updating speed of projectile
|
private |
Handle For Time line of updating speed
|
protected |
Curve float For Variable Speed of Projectile.Only Works when gravity scale is off that is when gravity scale is 0 and would be disabled