TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.WeaponAutoShoot Class Reference

Adds this component on a weapon with a WeaponAutoAim (2D or 3D) and it will automatically shoot at targets after an optional delay To prevent/stop auto shoot, simply disable this component, and enable it again to resume auto shoot. More...

Inheritance diagram for MoreMountains.TopDownEngine.WeaponAutoShoot:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Member Functions

virtual void SetCurrentWeapon (Weapon newWeapon)
 A public method you can use to update the cached Weapon.
virtual bool CanAutoShoot ()
 Returns true if this weapon can autoshoot, false otherwise.

Public Attributes

float DelayBeforeShootAfterAcquiringTarget = 0.1f
 the delay (in seconds) between acquiring a target and starting shooting at it
bool OnlyAutoShootIfOwnerIsIdle = false
 if this is true, the weapon will only auto shoot if its owner is idle

Protected Member Functions

virtual void Start ()
 On Awake we initialize our component.
virtual void Initialization ()
 Grabs auto aim and weapon.
virtual void LateUpdate ()
 On Update we handle auto shoot.
virtual void HandleAutoShoot ()
 Checks if we have a target for enough time, and shoots if needed.

Protected Attributes

WeaponAutoAim _weaponAutoAim
Weapon _weapon
bool _hasWeaponAndAutoAim
float _targetAcquiredAt
Transform _lastTarget

Detailed Description

Adds this component on a weapon with a WeaponAutoAim (2D or 3D) and it will automatically shoot at targets after an optional delay To prevent/stop auto shoot, simply disable this component, and enable it again to resume auto shoot.

Member Function Documentation

◆ CanAutoShoot()

virtual bool MoreMountains.TopDownEngine.WeaponAutoShoot.CanAutoShoot ( )
virtual

Returns true if this weapon can autoshoot, false otherwise.

Returns

◆ HandleAutoShoot()

virtual void MoreMountains.TopDownEngine.WeaponAutoShoot.HandleAutoShoot ( )
protectedvirtual

Checks if we have a target for enough time, and shoots if needed.

◆ Initialization()

virtual void MoreMountains.TopDownEngine.WeaponAutoShoot.Initialization ( )
protectedvirtual

Grabs auto aim and weapon.

◆ LateUpdate()

virtual void MoreMountains.TopDownEngine.WeaponAutoShoot.LateUpdate ( )
protectedvirtual

On Update we handle auto shoot.

◆ SetCurrentWeapon()

virtual void MoreMountains.TopDownEngine.WeaponAutoShoot.SetCurrentWeapon ( Weapon newWeapon)
virtual

A public method you can use to update the cached Weapon.

Parameters
newWeapon

◆ Start()

virtual void MoreMountains.TopDownEngine.WeaponAutoShoot.Start ( )
protectedvirtual

On Awake we initialize our component.

Member Data Documentation

◆ _hasWeaponAndAutoAim

bool MoreMountains.TopDownEngine.WeaponAutoShoot._hasWeaponAndAutoAim
protected

◆ _lastTarget

Transform MoreMountains.TopDownEngine.WeaponAutoShoot._lastTarget
protected

◆ _targetAcquiredAt

float MoreMountains.TopDownEngine.WeaponAutoShoot._targetAcquiredAt
protected

◆ _weapon

Weapon MoreMountains.TopDownEngine.WeaponAutoShoot._weapon
protected

◆ _weaponAutoAim

WeaponAutoAim MoreMountains.TopDownEngine.WeaponAutoShoot._weaponAutoAim
protected

◆ DelayBeforeShootAfterAcquiringTarget

float MoreMountains.TopDownEngine.WeaponAutoShoot.DelayBeforeShootAfterAcquiringTarget = 0.1f

the delay (in seconds) between acquiring a target and starting shooting at it

◆ OnlyAutoShootIfOwnerIsIdle

bool MoreMountains.TopDownEngine.WeaponAutoShoot.OnlyAutoShootIfOwnerIsIdle = false

if this is true, the weapon will only auto shoot if its owner is idle


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Characters/Weapons/WeaponAutoShoot.cs