Class EntityFirableWeapon
- Namespace
- VoxelPlayground.Entity
- Assembly
- GamePlay.dll
Base class for weapons that can fire projectiles or be used in attacks.
public class EntityFirableWeapon : EntityAttachmentItem
- Inheritance
-
objectEntityFirableWeapon
- Derived
- Inherited Members
- Extension Methods
Fields
ammoLeft
Current ammunition remaining.
public int ammoLeft
Field Value
- int
attackRange
Maximum range for AI to engage targets.
public float attackRange
Field Value
- float
firePoint
Transform representing the point from which projectiles are fired.
public Transform firePoint
Field Value
magAmmo
Maximum ammunition capacity or duration in seconds.
[InfoBox("MagAmmo is the bullet count, or life seconds.", InfoMessageType.Info, null)]
public int magAmmo
Field Value
- int
reloadTime
Time required to reload the weapon.
public float reloadTime
Field Value
- float
windUpTime
Time in seconds before the first shot can be fired.
[InfoBox("WindUpTime is the time it takes before first shot.", InfoMessageType.Info, null)]
public float windUpTime
Field Value
- float
Methods
Awake()
protected override void Awake()
CheckAmmoOtherwiseDestroy()
Consumes ammo and handles weapon destruction if out of ammo (for player).
protected virtual void CheckAmmoOtherwiseDestroy()
FireReloadPercentage()
Gets the percentage of reload progress or readiness to fire (0.0 to 1.0).
public virtual float FireReloadPercentage()
Returns
- float
The percentage value.
GetInfoPose()
Gets the InfoPose transform, used for UI or info display.
public Transform GetInfoPose()
Returns
- Transform
The InfoPose transform.
HasAmmo()
Checks if the weapon has ammunition left.
public bool HasAmmo()
Returns
- bool
True if ammo is greater than 0.
OnAbilityLongPressed()
Called when the ability button is long pressed.
public virtual void OnAbilityLongPressed()
OnAbilityPressed()
Called when the ability button is pressed.
public virtual void OnAbilityPressed()
OnCarried(EntityCharacter)
Called when the weapon is picked up by a character.
public override void OnCarried(EntityCharacter character)
Parameters
characterEntityCharacterThe character carrying the weapon.
OnReloadComplete()
Called when reloading is complete. Refills ammo.
protected virtual void OnReloadComplete()
OnTriggerPressed()
Called when the trigger is pressed.
public virtual void OnTriggerPressed()
OnTriggerReleased()
Called when the trigger is released.
public virtual void OnTriggerReleased()
RestoreFirePointLocalTransform()
Restores the fire point's local transform to its initial state.
public void RestoreFirePointLocalTransform()
Start()
protected override void Start()
UpdateFirePointOnTarget(Vector3)
Rotates the fire point to look at a target position.
public void UpdateFirePointOnTarget(Vector3 position)
Parameters
positionVector3The target world position.
UpdateReload(float)
Updates the reload process.
public void UpdateReload(float deltaTime)
Parameters
deltaTimefloatTime elapsed since last frame.