Modular Turret C++ Plugin
Version 3
Turret C++ Unreal engine 4 plugin
|
Public Member Functions | |
void | AimAt (const FVector &AimLocation) |
void | Fire () |
EMortarFiringState | GetCurrentState () const |
int32 | GetFiringCount () const |
int32 | GetReloadTimeInSeconds () const |
float | GetShotsSpreadDegree () const |
bool | HasUnlimitedAmmo () const |
void | InitializeAiming (class UMortarTurret *TurretToSet, UMortarBarrel *BarrelToSet) |
bool | IsBarrelMoving () |
void | ResetFiring () |
void | SetFiringLeft (const int32 &FiringLeft) |
void | SetIdle () |
virtual void | SetProjectile (const TMap< FName, TSubclassOf< class AActor >> &ProjectileToSet) |
void | SetReloadTimeInSeconds (const float &ReloadTime) |
void | SetShotsSpreadDegree (const float &ShotsSpread) |
UMortarAimingComponent () | |
Public Attributes | |
FMortarFireEvent | OnFireEvent |
Protected Member Functions | |
virtual void | BeginPlay () override |
virtual void | TickComponent (float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override |
Protected Attributes | |
class UMortarBarrel * | Barrel = nullptr |
class USoundBase * | FireSound |
TMap< FName, TSubclassOf< class AActor > > | ProjectileSpawnSockets |
class UMortarTurret * | Turret = nullptr |
Private Member Functions | |
class UMortarResourceManager * | GetValidSubSystem () |
void | MoveBarrelTowards (const FVector &AimDirection) |
void | ProjectileDestoryed (AActor *DestroyedActor) |
void | SetBarrelState () |
Private Attributes | |
uint32 | bCanShoot: 1 |
bool | bUnlimitedAmmo = true |
FVector | CurrentAimDirection |
EMortarFiringState | CurrentFiringState |
FVector | DefaultAimLocation |
int32 | FiringLeft = 1000 |
float | LastFireTime = 0 |
int32 | OriginalFiringLeft = 1000 |
float | OriginalReloadTimeInSeconds = 0.5f |
float | ReloadTimeInSeconds = 0.5f |
float | ShotsSpreadDegree = 2.f |
float | VectorThresholdComparision = 0.1f |
Mortar Aiming Component All Rotation ,Aiming And Firing Will be controlled by this class
UMortarAimingComponent::UMortarAimingComponent | ( | ) |
void UMortarAimingComponent::AimAt | ( | const FVector & | AimLocation | ) |
Checks if Mortar is able to aim and then moves mortar at the Desired Location
[in] | AimLocation | Desired Aiming Location in FVector |
|
overrideprotectedvirtual |
Called when the game starts
void UMortarAimingComponent::Fire | ( | ) |
Spawns A projectile at the desired socket location after checking mortar is in locked state
EMortarFiringState UMortarAimingComponent::GetCurrentState | ( | ) | const |
Gets The Current State of Gun
int32 UMortarAimingComponent::GetFiringCount | ( | ) | const |
Gets The Current Firing Count Left
int32 UMortarAimingComponent::GetReloadTimeInSeconds | ( | ) | const |
Gets Reload Time for The Mortar Gun i.e Time Delay between each shot
float UMortarAimingComponent::GetShotsSpreadDegree | ( | ) | const |
Gets Shots Spread Range which is used while Firing.
|
private |
Returns A Valid Subsystem Which has the resourcemanaging Part This also ensures that the subsystem is the blueprint one and not the cpp one return Pointer To SubSystem if valid nullptr otherwise
bool UMortarAimingComponent::HasUnlimitedAmmo | ( | ) | const |
Provides information whether there is limit on ammo
void UMortarAimingComponent::InitializeAiming | ( | class UMortarTurret * | TurretToSet, |
UMortarBarrel * | BarrelToSet | ||
) |
Initializes Turret and Barrel
[in] | TurretToSet | Turret That will be used while Aiming |
[in] | BarrelToSet | Barrel that will be used while aiming |
bool UMortarAimingComponent::IsBarrelMoving | ( | ) |
returns true if the barrel is moving compares the barrel/Gun forward vector
|
private |
Move the Barrel at the given Direction And also Rotates turret param[in] AimDirection Direction to aim. It is the direction which we estimated
|
private |
void UMortarAimingComponent::ResetFiring | ( | ) |
Resets Firing Parameters like count,speed etc can be used after powerup
|
private |
Sets State of Barrel like Moving,locked etc
void UMortarAimingComponent::SetFiringLeft | ( | const int32 & | FiringLeft | ) |
Sets Firing Left
[in] | FiringLeft | Firing Count Left |
void UMortarAimingComponent::SetIdle | ( | ) |
Sets Turret and Barrel at Idle Position
|
virtual |
Sets Projectile Class that needs to be spawned.On special event Mortar Can have different projectile
[in] | ProjectileToSet | Projectile to spawn of Class Projectile |
void UMortarAimingComponent::SetReloadTimeInSeconds | ( | const float & | ReloadTime | ) |
Sets Time Delay between each shots
[in] | ReloadTime | Float variable containing reload Time |
void UMortarAimingComponent::SetShotsSpreadDegree | ( | const float & | ShotsSpread | ) |
Sets Shots Spread Range
[in] | ShotsSpread | Shots Spread In Degree |
|
overrideprotectedvirtual |
Function Called on Every Tick
|
protected |
Barrel/Gun Class to Use Moves Vertically
|
private |
Whether Mortar Can Shoot or not
|
private |
Allow Unlimited Firing
|
private |
Current Aim Direction of the mortar gun
|
private |
Stores Current Firing state used by BP
|
private |
Default Aim Locatin of Barrel
|
protected |
Sound Played on Each Mortar Firing
|
private |
Allow to use Firing Left Only if Unlimited Ammo is off
|
private |
Stores Last Firing Time
FMortarFireEvent UMortarAimingComponent::OnFireEvent |
Event Called Just Before Spawning a Projectile actor
|
private |
Original Firing Left Count
|
private |
Original Reload Time In Seconds
|
protected |
This is a map of Socket Name To Projectile Telling Which socket has to Fire which projectile
|
private |
Time Delay Between each shots
|
private |
How much shorts can Be Spread in Degrees Shots Spread Range between -ShotsSpreadDegree to ShotsSpreadDegree inclusive
|
protected |
Turret Class to Use Moves Horizontally
|
private |
This is used to for comparing Aim Direction and Forward Vector of Gun To check if they are in same direction