TopDown Engine  v3.6
MoreMountains.TopDownEngine.Weapon Class Reference

This base class, meant to be extended (see ProjectileWeapon.cs for an example of that) handles rate of fire (rate of use actually), and ammo reloading More...

Inheritance diagram for MoreMountains.TopDownEngine.Weapon:
MoreMountains.Tools.MMMonoBehaviour MoreMountains.TopDownEngine.ChargeWeapon MoreMountains.TopDownEngine.ExplodudesWeapon MoreMountains.TopDownEngine.HitscanWeapon MoreMountains.TopDownEngine.MeleeWeapon MoreMountains.TopDownEngine.ProjectileWeapon

Public Types

enum  TriggerModes { TriggerModes.SemiAuto, TriggerModes.Auto }
 the possible use modes for the trigger (semi auto : the Player needs to release the trigger to fire again, auto : the Player can hold the trigger to fire repeatedly More...
 
enum  WeaponStates {
  WeaponStates.WeaponIdle, WeaponStates.WeaponStart, WeaponStates.WeaponDelayBeforeUse, WeaponStates.WeaponUse,
  WeaponStates.WeaponDelayBetweenUses, WeaponStates.WeaponStop, WeaponStates.WeaponReloadNeeded, WeaponStates.WeaponReloadStart,
  WeaponStates.WeaponReload, WeaponStates.WeaponReloadStop, WeaponStates.WeaponInterrupted
}
 the possible states the weapon can be in More...
 

Public Member Functions

virtual void Initialization ()
 Initialize this weapon. More...
 
virtual void InitializeComboWeapons ()
 Initializes the combo weapon, if it's one More...
 
virtual void SetOwner (Character newOwner, CharacterHandleWeapon handleWeapon)
 Sets the weapon's owner More...
 
virtual void WeaponInputStart ()
 Called by input, turns the weapon on More...
 
virtual void WeaponInputReleased ()
 Describes what happens when the weapon's input gets released More...
 
virtual void TurnWeaponOn ()
 Describes what happens when the weapon starts More...
 
virtual void CaseWeaponIdle ()
 If the weapon is idle, we reset the movement multiplier More...
 
virtual void CaseWeaponStart ()
 When the weapon starts we switch to a delay or shoot based on our weapon's settings More...
 
virtual void CaseWeaponDelayBeforeUse ()
 If we're in delay before use, we wait until our delay is passed and then request a shoot More...
 
virtual void CaseWeaponUse ()
 On weapon use we use our weapon then switch to delay between uses More...
 
virtual void CaseWeaponDelayBetweenUses ()
 When in delay between uses, we either turn our weapon off or make a shoot request More...
 
virtual void CaseWeaponStop ()
 On weapon stop, we switch to idle More...
 
virtual void CaseWeaponReloadNeeded ()
 If a reload is needed, we mention it and switch to idle More...
 
virtual void CaseWeaponReloadStart ()
 on reload start, we reload the weapon and switch to reload More...
 
virtual void CaseWeaponReload ()
 on reload, we reset our movement multiplier, and switch to reload stop once our reload delay has passed More...
 
virtual void CaseWeaponReloadStop ()
 on reload stop, we swtich to idle and load our ammo More...
 
virtual void CaseWeaponInterrupted ()
 on weapon interrupted, we turn our weapon off and switch back to idle More...
 
virtual void Interrupt ()
 Call this method to interrupt the weapon More...
 
virtual IEnumerator ShootRequestCo ()
 Determines whether or not the weapon can fire More...
 
virtual void ShootRequest ()
 
virtual void WeaponUse ()
 When the weapon is used, plays the corresponding sound More...
 
virtual void WeaponInputStop ()
 Called by input, turns the weapon off if in auto mode More...
 
virtual void TurnWeaponOff ()
 Turns the weapon off. More...
 
virtual void ReloadNeeded ()
 Describes what happens when the weapon needs a reload More...
 
virtual void InitiateReloadWeapon ()
 Initiates a reload More...
 
virtual void FlipWeapon ()
 Flips the weapon. More...
 
virtual IEnumerator WeaponDestruction ()
 Destroys the weapon More...
 
virtual void ApplyOffset ()
 Applies the offset specified in the inspector More...
 
virtual void InitializeAnimatorParameters ()
 Adds required animator parameters to the animator parameters list if they exist More...
 
virtual void UpdateAnimator ()
 Override this to send parameters to the character's animator. This is called once per cycle, by the Character class, after Early, normal and Late process(). More...
 

Public Attributes

string WeaponName
 the name of the weapon, only used for debugging More...
 
bool WeaponCurrentlyActive = true
 whether or not the weapon is currently active More...
 
bool InputAuthorized = true
 if this is true, this weapon will be able to read input (usually via the CharacterHandleWeapon ability), otherwise player input will be disabled More...
 
TriggerModes TriggerMode = TriggerModes.Auto
 is this weapon on semi or full auto ? More...
 
float DelayBeforeUse = 0f
 the delay before use, that will be applied for every shot More...
 
bool DelayBeforeUseReleaseInterruption = true
 whether or not the delay before used can be interrupted by releasing the shoot button (if true, releasing the button will cancel the delayed shot) More...
 
float TimeBetweenUses = 1f
 the time (in seconds) between two shots
More...
 
bool TimeBetweenUsesReleaseInterruption = true
 whether or not the time between uses can be interrupted by releasing the shoot button (if true, releasing the button will cancel the time between uses) More...
 
bool UseBurstMode = false
 if this is true, the weapon will activate repeatedly for every shoot request More...
 
int BurstLength = 3
 the amount of 'shots' in a burst sequence More...
 
float BurstTimeBetweenShots = 0.1f
 the time between shots in a burst sequence (in seconds) More...
 
bool MagazineBased = false
 whether or not the weapon is magazine based. If it's not, it'll just take its ammo inside a global pool More...
 
int MagazineSize = 30
 the size of the magazine More...
 
bool AutoReload
 if this is true, pressing the fire button when a reload is needed will reload the weapon. Otherwise you'll need to press the reload button More...
 
bool NoInputReload = false
 if this is true, reload will automatically happen right after the last bullet is shot, without the need for input More...
 
float ReloadTime = 2f
 the time it takes to reload the weapon More...
 
int AmmoConsumedPerShot = 1
 the amount of ammo consumed everytime the weapon fires More...
 
bool AutoDestroyWhenEmpty
 if this is set to true, the weapon will auto destroy when there's no ammo left More...
 
float AutoDestroyWhenEmptyDelay = 1f
 the delay (in seconds) before weapon destruction if empty More...
 
bool PreventReloadIfAmmoEmpty = false
 if this is true, the weapon won't try and reload if the ammo is empty, when using WeaponAmmo More...
 
int CurrentAmmoLoaded = 0
 the current amount of ammo loaded inside the weapon More...
 
Vector3 WeaponAttachmentOffset = Vector3.zero
 an offset that will be applied to the weapon once attached to the center of the WeaponAttachment transform. More...
 
bool FlipWeaponOnCharacterFlip = true
 should that weapon be flipped when the character flips? More...
 
Vector3 RightFacingFlipValue = new Vector3(1, 1, 1)
 the FlipValue will be used to multiply the model's transform's localscale on flip. Usually it's -1,1,1, but feel free to change it to suit your model's specs More...
 
Vector3 LeftFacingFlipValue = new Vector3(-1, 1, 1)
 the FlipValue will be used to multiply the model's transform's localscale on flip. Usually it's -1,1,1, but feel free to change it to suit your model's specs More...
 
Transform WeaponUseTransform
 a transform to use as the spawn point for weapon use (if null, only offset will be considered, otherwise the transform without offset) More...
 
bool WeaponShouldFlip = true
 if this is true, the weapon will flip to match the character's orientation More...
 
Transform LeftHandHandle
 the transform to which the character's left hand should be attached to More...
 
Transform RightHandHandle
 the transform to which the character's right hand should be attached to More...
 
bool ModifyMovementWhileAttacking = false
 if this is true, a multiplier will be applied to movement while the weapon is active More...
 
float MovementMultiplier = 0f
 the multiplier to apply to movement while attacking More...
 
bool PreventAllMovementWhileInUse = false
 if this is true all movement will be prevented (even flip) while the weapon is active More...
 
bool PreventAllAimWhileInUse = false
 if this is true all aim will be prevented while the weapon is active More...
 
float RecoilForce = 0f
 the force to apply to push the character back when shooting - positive values will push the character back, negative values will launch it forward, turning that recoil into a thrust More...
 
List< Animator > Animators
 the other animators (other than the Character's) that you want to update every time this weapon gets used More...
 
bool PerformAnimatorSanityChecks = false
 If this is true, sanity checks will be performed to make sure animator parameters exist before updating them. Turning this to false will increase performance but will throw errors if you're trying to update non existing parameters. Make sure your animator has the required parameters. More...
 
bool MirrorCharacterAnimatorParameters = false
 if this is true, the weapon's animator(s) will mirror the animation parameter of the owner character (that way your weapon's animator will be able to "know" if the character is walking, jumping, etc) More...
 
int WeaponAnimationID = 0
 the ID of the weapon to pass to the animator More...
 
string IdleAnimationParameter
 the name of the weapon's idle animation parameter : this will be true all the time except when the weapon is being used More...
 
string StartAnimationParameter
 the name of the weapon's start animation parameter : true at the frame where the weapon starts being used More...
 
string DelayBeforeUseAnimationParameter
 the name of the weapon's delay before use animation parameter : true when the weapon has been activated but hasn't been used yet More...
 
string SingleUseAnimationParameter
 the name of the weapon's single use animation parameter : true at each frame the weapon activates (shoots) More...
 
string UseAnimationParameter
 the name of the weapon's in use animation parameter : true at each frame the weapon has started firing but hasn't stopped yet More...
 
string DelayBetweenUsesAnimationParameter
 the name of the weapon's delay between each use animation parameter : true when the weapon is in use More...
 
string StopAnimationParameter
 the name of the weapon stop animation parameter : true after a shot and before the next one or the weapon's stop More...
 
string ReloadStartAnimationParameter
 the name of the weapon reload start animation parameter More...
 
string ReloadAnimationParameter
 the name of the weapon reload animation parameter More...
 
string ReloadStopAnimationParameter
 the name of the weapon reload end animation parameter More...
 
string WeaponAngleAnimationParameter
 the name of the weapon's angle animation parameter More...
 
string WeaponAngleRelativeAnimationParameter
 the name of the weapon's angle animation parameter, adjusted so it's always relative to the direction the character is currently facing More...
 
string EquippedAnimationParameter
 the name of the parameter to send to true as long as this weapon is equipped, used or not. While all the other parameters defined here are updated by the Weapon class itself, and passed to the weapon and character, this one will be updated by CharacterHandleWeapon only." More...
 
MMFeedbacks WeaponStartMMFeedback
 the feedback to play when the weapon starts being used More...
 
MMFeedbacks WeaponUsedMMFeedback
 the feedback to play while the weapon is in use More...
 
MMFeedbacks WeaponUsedMMFeedbackAlt
 if set, this feedback will be used randomly instead of WeaponUsedMMFeedback More...
 
MMFeedbacks WeaponStopMMFeedback
 the feedback to play when the weapon stops being used More...
 
MMFeedbacks WeaponReloadMMFeedback
 the feedback to play when the weapon gets reloaded More...
 
MMFeedbacks WeaponReloadNeededMMFeedback
 the feedback to play when the weapon gets reloaded More...
 
MMFeedbacks WeaponReloadImpossibleMMFeedback
 the feedback to play when the weapon can't reload as there's no more ammo available. You'll need PreventReloadIfAmmoEmpty to be true for this to work More...
 
bool InitializeOnStart = false
 If this is true, the weapon will initialize itself on start, otherwise it'll have to be init manually, usually by the CharacterHandleWeapon class. More...
 
bool Interruptable = false
 whether or not this weapon can be interrupted More...
 
bool Flipped
 if true, the weapon is flipped More...
 
MMStateMachine< WeaponStatesWeaponState
 the weapon's state machine More...
 

Protected Member Functions

virtual void Start ()
 On start we initialize our weapon More...
 
virtual void InitializeFeedbacks ()
 
virtual void Update ()
 On Update, we check if the weapon is or should be used More...
 
virtual void LateUpdate ()
 On LateUpdate, processes the weapon state More...
 
virtual void ProcessWeaponState ()
 Called every lastUpdate, processes the weapon's state machine More...
 
virtual void ApplyRecoil ()
 Applies recoil if necessary More...
 
virtual void ResetMovementMultiplier ()
 
virtual void ReloadWeapon ()
 Reloads the weapon More...
 
virtual void TriggerWeaponStartFeedback ()
 Plays the weapon's start sound More...
 
virtual void TriggerWeaponUsedFeedback ()
 Plays the weapon's used sound More...
 
virtual void TriggerWeaponStopFeedback ()
 Plays the weapon's stop sound More...
 
virtual void TriggerWeaponReloadNeededFeedback ()
 Plays the weapon's reload needed sound More...
 
virtual void TriggerWeaponReloadFeedback ()
 Plays the weapon's reload sound More...
 
virtual void AddParametersToAnimator (Animator animator, HashSet< int > list)
 
virtual void UpdateAnimator (Animator animator, HashSet< int > list)
 

Protected Attributes

SpriteRenderer _spriteRenderer
 
WeaponAim _weaponAim
 
float _movementMultiplierStorage = 1f
 
Animator _ownerAnimator
 
WeaponPreventShooting _weaponPreventShooting
 
float _delayBeforeUseCounter = 0f
 
float _delayBetweenUsesCounter = 0f
 
float _reloadingCounter = 0f
 
bool _triggerReleased = false
 
bool _reloading = false
 
ComboWeapon _comboWeapon
 
TopDownController _controller
 
CharacterMovement _characterMovement
 
Vector3 _weaponOffset
 
Vector3 _weaponAttachmentOffset
 
Transform _weaponAttachment
 
List< HashSet< int > > _animatorParameters
 
HashSet< int > _ownerAnimatorParameters
 
bool _controllerIs3D = false
 
int _idleAnimationParameter
 
int _startAnimationParameter
 
int _delayBeforeUseAnimationParameter
 
int _singleUseAnimationParameter
 
int _useAnimationParameter
 
int _delayBetweenUsesAnimationParameter
 
int _stopAnimationParameter
 
int _reloadStartAnimationParameter
 
int _reloadAnimationParameter
 
int _reloadStopAnimationParameter
 
int _weaponAngleAnimationParameter
 
int _weaponAngleRelativeAnimationParameter
 
int _aliveAnimationParameter
 
int _comboInProgressAnimationParameter
 
int _equippedAnimationParameter
 
float _lastShootRequestAt = -float.MaxValue
 
float _lastTurnWeaponOnAt = -float.MaxValue
 
bool _movementSpeedMultiplierSet = false
 

Static Protected Attributes

const string _aliveAnimationParameterName = "Alive"
 

Properties

virtual string WeaponID [get, set]
 the name of the inventory item corresponding to this weapon. Automatically set (if needed) by InventoryEngineWeapon More...
 
virtual Character Owner [get, protected set]
 the weapon's owner More...
 
virtual CharacterHandleWeapon CharacterHandleWeapon [get, set]
 the weapon's owner's CharacterHandleWeapon component More...
 
virtual WeaponAmmo WeaponAmmo [get, protected set]
 the WeaponAmmo component optionnally associated to this weapon More...
 
float MovementMultiplierStorage [get, set]
 

Detailed Description

This base class, meant to be extended (see ProjectileWeapon.cs for an example of that) handles rate of fire (rate of use actually), and ammo reloading

Member Enumeration Documentation

◆ TriggerModes

the possible use modes for the trigger (semi auto : the Player needs to release the trigger to fire again, auto : the Player can hold the trigger to fire repeatedly

Enumerator
SemiAuto 
Auto 

◆ WeaponStates

the possible states the weapon can be in

Enumerator
WeaponIdle 
WeaponStart 
WeaponDelayBeforeUse 
WeaponUse 
WeaponDelayBetweenUses 
WeaponStop 
WeaponReloadNeeded 
WeaponReloadStart 
WeaponReload 
WeaponReloadStop 
WeaponInterrupted 

Member Function Documentation

◆ AddParametersToAnimator()

virtual void MoreMountains.TopDownEngine.Weapon.AddParametersToAnimator ( Animator  animator,
HashSet< int >  list 
)
protectedvirtual

◆ ApplyOffset()

virtual void MoreMountains.TopDownEngine.Weapon.ApplyOffset ( )
virtual

Applies the offset specified in the inspector

◆ ApplyRecoil()

virtual void MoreMountains.TopDownEngine.Weapon.ApplyRecoil ( )
protectedvirtual

Applies recoil if necessary

◆ CaseWeaponDelayBeforeUse()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponDelayBeforeUse ( )
virtual

If we're in delay before use, we wait until our delay is passed and then request a shoot

◆ CaseWeaponDelayBetweenUses()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponDelayBetweenUses ( )
virtual

When in delay between uses, we either turn our weapon off or make a shoot request

◆ CaseWeaponIdle()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponIdle ( )
virtual

If the weapon is idle, we reset the movement multiplier

◆ CaseWeaponInterrupted()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponInterrupted ( )
virtual

on weapon interrupted, we turn our weapon off and switch back to idle

◆ CaseWeaponReload()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponReload ( )
virtual

on reload, we reset our movement multiplier, and switch to reload stop once our reload delay has passed

◆ CaseWeaponReloadNeeded()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponReloadNeeded ( )
virtual

If a reload is needed, we mention it and switch to idle

◆ CaseWeaponReloadStart()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponReloadStart ( )
virtual

on reload start, we reload the weapon and switch to reload

◆ CaseWeaponReloadStop()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponReloadStop ( )
virtual

on reload stop, we swtich to idle and load our ammo

◆ CaseWeaponStart()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponStart ( )
virtual

When the weapon starts we switch to a delay or shoot based on our weapon's settings

◆ CaseWeaponStop()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponStop ( )
virtual

On weapon stop, we switch to idle

◆ CaseWeaponUse()

virtual void MoreMountains.TopDownEngine.Weapon.CaseWeaponUse ( )
virtual

On weapon use we use our weapon then switch to delay between uses

◆ FlipWeapon()

virtual void MoreMountains.TopDownEngine.Weapon.FlipWeapon ( )
virtual

Flips the weapon.

Reimplemented in MoreMountains.TopDownEngine.ChargeWeapon.

◆ Initialization()

◆ InitializeAnimatorParameters()

virtual void MoreMountains.TopDownEngine.Weapon.InitializeAnimatorParameters ( )
virtual

Adds required animator parameters to the animator parameters list if they exist

◆ InitializeComboWeapons()

virtual void MoreMountains.TopDownEngine.Weapon.InitializeComboWeapons ( )
virtual

Initializes the combo weapon, if it's one

◆ InitializeFeedbacks()

virtual void MoreMountains.TopDownEngine.Weapon.InitializeFeedbacks ( )
protectedvirtual

◆ InitiateReloadWeapon()

virtual void MoreMountains.TopDownEngine.Weapon.InitiateReloadWeapon ( )
virtual

Initiates a reload

◆ Interrupt()

virtual void MoreMountains.TopDownEngine.Weapon.Interrupt ( )
virtual

Call this method to interrupt the weapon

◆ LateUpdate()

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

On LateUpdate, processes the weapon state

◆ ProcessWeaponState()

virtual void MoreMountains.TopDownEngine.Weapon.ProcessWeaponState ( )
protectedvirtual

Called every lastUpdate, processes the weapon's state machine

◆ ReloadNeeded()

virtual void MoreMountains.TopDownEngine.Weapon.ReloadNeeded ( )
virtual

Describes what happens when the weapon needs a reload

◆ ReloadWeapon()

virtual void MoreMountains.TopDownEngine.Weapon.ReloadWeapon ( )
protectedvirtual

Reloads the weapon

Parameters
ammoAmmo.

◆ ResetMovementMultiplier()

virtual void MoreMountains.TopDownEngine.Weapon.ResetMovementMultiplier ( )
protectedvirtual

◆ SetOwner()

virtual void MoreMountains.TopDownEngine.Weapon.SetOwner ( Character  newOwner,
CharacterHandleWeapon  handleWeapon 
)
virtual

Sets the weapon's owner

Parameters
newOwnerNew owner.

◆ ShootRequest()

virtual void MoreMountains.TopDownEngine.Weapon.ShootRequest ( )
virtual

◆ ShootRequestCo()

virtual IEnumerator MoreMountains.TopDownEngine.Weapon.ShootRequestCo ( )
virtual

Determines whether or not the weapon can fire

◆ Start()

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

On start we initialize our weapon

◆ TriggerWeaponReloadFeedback()

virtual void MoreMountains.TopDownEngine.Weapon.TriggerWeaponReloadFeedback ( )
protectedvirtual

Plays the weapon's reload sound

◆ TriggerWeaponReloadNeededFeedback()

virtual void MoreMountains.TopDownEngine.Weapon.TriggerWeaponReloadNeededFeedback ( )
protectedvirtual

Plays the weapon's reload needed sound

◆ TriggerWeaponStartFeedback()

virtual void MoreMountains.TopDownEngine.Weapon.TriggerWeaponStartFeedback ( )
protectedvirtual

Plays the weapon's start sound

◆ TriggerWeaponStopFeedback()

virtual void MoreMountains.TopDownEngine.Weapon.TriggerWeaponStopFeedback ( )
protectedvirtual

Plays the weapon's stop sound

◆ TriggerWeaponUsedFeedback()

virtual void MoreMountains.TopDownEngine.Weapon.TriggerWeaponUsedFeedback ( )
protectedvirtual

Plays the weapon's used sound

◆ TurnWeaponOff()

virtual void MoreMountains.TopDownEngine.Weapon.TurnWeaponOff ( )
virtual

Turns the weapon off.

◆ TurnWeaponOn()

virtual void MoreMountains.TopDownEngine.Weapon.TurnWeaponOn ( )
virtual

Describes what happens when the weapon starts

Reimplemented in MoreMountains.TopDownEngine.ChargeWeapon.

◆ Update()

virtual void MoreMountains.TopDownEngine.Weapon.Update ( )
protectedvirtual

On Update, we check if the weapon is or should be used

Reimplemented in MoreMountains.TopDownEngine.ChargeWeapon, and MoreMountains.TopDownEngine.ExplodudesWeapon.

◆ UpdateAnimator() [1/2]

virtual void MoreMountains.TopDownEngine.Weapon.UpdateAnimator ( )
virtual

Override this to send parameters to the character's animator. This is called once per cycle, by the Character class, after Early, normal and Late process().

◆ UpdateAnimator() [2/2]

virtual void MoreMountains.TopDownEngine.Weapon.UpdateAnimator ( Animator  animator,
HashSet< int >  list 
)
protectedvirtual

◆ WeaponDestruction()

virtual IEnumerator MoreMountains.TopDownEngine.Weapon.WeaponDestruction ( )
virtual

Destroys the weapon

Returns
The destruction.

◆ WeaponInputReleased()

virtual void MoreMountains.TopDownEngine.Weapon.WeaponInputReleased ( )
virtual

Describes what happens when the weapon's input gets released

Reimplemented in MoreMountains.TopDownEngine.ChargeWeapon.

◆ WeaponInputStart()

virtual void MoreMountains.TopDownEngine.Weapon.WeaponInputStart ( )
virtual

Called by input, turns the weapon on

◆ WeaponInputStop()

virtual void MoreMountains.TopDownEngine.Weapon.WeaponInputStop ( )
virtual

Called by input, turns the weapon off if in auto mode

◆ WeaponUse()

virtual void MoreMountains.TopDownEngine.Weapon.WeaponUse ( )
virtual

When the weapon is used, plays the corresponding sound

Reimplemented in MoreMountains.TopDownEngine.MeleeWeapon, MoreMountains.TopDownEngine.HitscanWeapon, and MoreMountains.TopDownEngine.ProjectileWeapon.

Member Data Documentation

◆ _aliveAnimationParameter

int MoreMountains.TopDownEngine.Weapon._aliveAnimationParameter
protected

◆ _aliveAnimationParameterName

const string MoreMountains.TopDownEngine.Weapon._aliveAnimationParameterName = "Alive"
staticprotected

◆ _animatorParameters

List<HashSet<int> > MoreMountains.TopDownEngine.Weapon._animatorParameters
protected

◆ _characterMovement

CharacterMovement MoreMountains.TopDownEngine.Weapon._characterMovement
protected

◆ _comboInProgressAnimationParameter

int MoreMountains.TopDownEngine.Weapon._comboInProgressAnimationParameter
protected

◆ _comboWeapon

ComboWeapon MoreMountains.TopDownEngine.Weapon._comboWeapon
protected

◆ _controller

TopDownController MoreMountains.TopDownEngine.Weapon._controller
protected

◆ _controllerIs3D

bool MoreMountains.TopDownEngine.Weapon._controllerIs3D = false
protected

◆ _delayBeforeUseAnimationParameter

int MoreMountains.TopDownEngine.Weapon._delayBeforeUseAnimationParameter
protected

◆ _delayBeforeUseCounter

float MoreMountains.TopDownEngine.Weapon._delayBeforeUseCounter = 0f
protected

◆ _delayBetweenUsesAnimationParameter

int MoreMountains.TopDownEngine.Weapon._delayBetweenUsesAnimationParameter
protected

◆ _delayBetweenUsesCounter

float MoreMountains.TopDownEngine.Weapon._delayBetweenUsesCounter = 0f
protected

◆ _equippedAnimationParameter

int MoreMountains.TopDownEngine.Weapon._equippedAnimationParameter
protected

◆ _idleAnimationParameter

int MoreMountains.TopDownEngine.Weapon._idleAnimationParameter
protected

◆ _lastShootRequestAt

float MoreMountains.TopDownEngine.Weapon._lastShootRequestAt = -float.MaxValue
protected

◆ _lastTurnWeaponOnAt

float MoreMountains.TopDownEngine.Weapon._lastTurnWeaponOnAt = -float.MaxValue
protected

◆ _movementMultiplierStorage

float MoreMountains.TopDownEngine.Weapon._movementMultiplierStorage = 1f
protected

◆ _movementSpeedMultiplierSet

bool MoreMountains.TopDownEngine.Weapon._movementSpeedMultiplierSet = false
protected

◆ _ownerAnimator

Animator MoreMountains.TopDownEngine.Weapon._ownerAnimator
protected

◆ _ownerAnimatorParameters

HashSet<int> MoreMountains.TopDownEngine.Weapon._ownerAnimatorParameters
protected

◆ _reloadAnimationParameter

int MoreMountains.TopDownEngine.Weapon._reloadAnimationParameter
protected

◆ _reloading

bool MoreMountains.TopDownEngine.Weapon._reloading = false
protected

◆ _reloadingCounter

float MoreMountains.TopDownEngine.Weapon._reloadingCounter = 0f
protected

◆ _reloadStartAnimationParameter

int MoreMountains.TopDownEngine.Weapon._reloadStartAnimationParameter
protected

◆ _reloadStopAnimationParameter

int MoreMountains.TopDownEngine.Weapon._reloadStopAnimationParameter
protected

◆ _singleUseAnimationParameter

int MoreMountains.TopDownEngine.Weapon._singleUseAnimationParameter
protected

◆ _spriteRenderer

SpriteRenderer MoreMountains.TopDownEngine.Weapon._spriteRenderer
protected

◆ _startAnimationParameter

int MoreMountains.TopDownEngine.Weapon._startAnimationParameter
protected

◆ _stopAnimationParameter

int MoreMountains.TopDownEngine.Weapon._stopAnimationParameter
protected

◆ _triggerReleased

bool MoreMountains.TopDownEngine.Weapon._triggerReleased = false
protected

◆ _useAnimationParameter

int MoreMountains.TopDownEngine.Weapon._useAnimationParameter
protected

◆ _weaponAim

WeaponAim MoreMountains.TopDownEngine.Weapon._weaponAim
protected

◆ _weaponAngleAnimationParameter

int MoreMountains.TopDownEngine.Weapon._weaponAngleAnimationParameter
protected

◆ _weaponAngleRelativeAnimationParameter

int MoreMountains.TopDownEngine.Weapon._weaponAngleRelativeAnimationParameter
protected

◆ _weaponAttachment

Transform MoreMountains.TopDownEngine.Weapon._weaponAttachment
protected

◆ _weaponAttachmentOffset

Vector3 MoreMountains.TopDownEngine.Weapon._weaponAttachmentOffset
protected

◆ _weaponOffset

Vector3 MoreMountains.TopDownEngine.Weapon._weaponOffset
protected

◆ _weaponPreventShooting

WeaponPreventShooting MoreMountains.TopDownEngine.Weapon._weaponPreventShooting
protected

◆ AmmoConsumedPerShot

int MoreMountains.TopDownEngine.Weapon.AmmoConsumedPerShot = 1

the amount of ammo consumed everytime the weapon fires

◆ Animators

List<Animator> MoreMountains.TopDownEngine.Weapon.Animators

the other animators (other than the Character's) that you want to update every time this weapon gets used

◆ AutoDestroyWhenEmpty

bool MoreMountains.TopDownEngine.Weapon.AutoDestroyWhenEmpty

if this is set to true, the weapon will auto destroy when there's no ammo left

◆ AutoDestroyWhenEmptyDelay

float MoreMountains.TopDownEngine.Weapon.AutoDestroyWhenEmptyDelay = 1f

the delay (in seconds) before weapon destruction if empty

◆ AutoReload

bool MoreMountains.TopDownEngine.Weapon.AutoReload

if this is true, pressing the fire button when a reload is needed will reload the weapon. Otherwise you'll need to press the reload button

◆ BurstLength

int MoreMountains.TopDownEngine.Weapon.BurstLength = 3

the amount of 'shots' in a burst sequence

◆ BurstTimeBetweenShots

float MoreMountains.TopDownEngine.Weapon.BurstTimeBetweenShots = 0.1f

the time between shots in a burst sequence (in seconds)

◆ CurrentAmmoLoaded

int MoreMountains.TopDownEngine.Weapon.CurrentAmmoLoaded = 0

the current amount of ammo loaded inside the weapon

◆ DelayBeforeUse

float MoreMountains.TopDownEngine.Weapon.DelayBeforeUse = 0f

the delay before use, that will be applied for every shot

◆ DelayBeforeUseAnimationParameter

string MoreMountains.TopDownEngine.Weapon.DelayBeforeUseAnimationParameter

the name of the weapon's delay before use animation parameter : true when the weapon has been activated but hasn't been used yet

◆ DelayBeforeUseReleaseInterruption

bool MoreMountains.TopDownEngine.Weapon.DelayBeforeUseReleaseInterruption = true

whether or not the delay before used can be interrupted by releasing the shoot button (if true, releasing the button will cancel the delayed shot)

◆ DelayBetweenUsesAnimationParameter

string MoreMountains.TopDownEngine.Weapon.DelayBetweenUsesAnimationParameter

the name of the weapon's delay between each use animation parameter : true when the weapon is in use

◆ EquippedAnimationParameter

string MoreMountains.TopDownEngine.Weapon.EquippedAnimationParameter

the name of the parameter to send to true as long as this weapon is equipped, used or not. While all the other parameters defined here are updated by the Weapon class itself, and passed to the weapon and character, this one will be updated by CharacterHandleWeapon only."

◆ Flipped

bool MoreMountains.TopDownEngine.Weapon.Flipped

if true, the weapon is flipped

◆ FlipWeaponOnCharacterFlip

bool MoreMountains.TopDownEngine.Weapon.FlipWeaponOnCharacterFlip = true

should that weapon be flipped when the character flips?

◆ IdleAnimationParameter

string MoreMountains.TopDownEngine.Weapon.IdleAnimationParameter

the name of the weapon's idle animation parameter : this will be true all the time except when the weapon is being used

◆ InitializeOnStart

bool MoreMountains.TopDownEngine.Weapon.InitializeOnStart = false

If this is true, the weapon will initialize itself on start, otherwise it'll have to be init manually, usually by the CharacterHandleWeapon class.

◆ InputAuthorized

bool MoreMountains.TopDownEngine.Weapon.InputAuthorized = true

if this is true, this weapon will be able to read input (usually via the CharacterHandleWeapon ability), otherwise player input will be disabled

◆ Interruptable

bool MoreMountains.TopDownEngine.Weapon.Interruptable = false

whether or not this weapon can be interrupted

◆ LeftFacingFlipValue

Vector3 MoreMountains.TopDownEngine.Weapon.LeftFacingFlipValue = new Vector3(-1, 1, 1)

the FlipValue will be used to multiply the model's transform's localscale on flip. Usually it's -1,1,1, but feel free to change it to suit your model's specs

◆ LeftHandHandle

Transform MoreMountains.TopDownEngine.Weapon.LeftHandHandle

the transform to which the character's left hand should be attached to

◆ MagazineBased

bool MoreMountains.TopDownEngine.Weapon.MagazineBased = false

whether or not the weapon is magazine based. If it's not, it'll just take its ammo inside a global pool

◆ MagazineSize

int MoreMountains.TopDownEngine.Weapon.MagazineSize = 30

the size of the magazine

◆ MirrorCharacterAnimatorParameters

bool MoreMountains.TopDownEngine.Weapon.MirrorCharacterAnimatorParameters = false

if this is true, the weapon's animator(s) will mirror the animation parameter of the owner character (that way your weapon's animator will be able to "know" if the character is walking, jumping, etc)

◆ ModifyMovementWhileAttacking

bool MoreMountains.TopDownEngine.Weapon.ModifyMovementWhileAttacking = false

if this is true, a multiplier will be applied to movement while the weapon is active

◆ MovementMultiplier

float MoreMountains.TopDownEngine.Weapon.MovementMultiplier = 0f

the multiplier to apply to movement while attacking

◆ NoInputReload

bool MoreMountains.TopDownEngine.Weapon.NoInputReload = false

if this is true, reload will automatically happen right after the last bullet is shot, without the need for input

◆ PerformAnimatorSanityChecks

bool MoreMountains.TopDownEngine.Weapon.PerformAnimatorSanityChecks = false

If this is true, sanity checks will be performed to make sure animator parameters exist before updating them. Turning this to false will increase performance but will throw errors if you're trying to update non existing parameters. Make sure your animator has the required parameters.

◆ PreventAllAimWhileInUse

bool MoreMountains.TopDownEngine.Weapon.PreventAllAimWhileInUse = false

if this is true all aim will be prevented while the weapon is active

◆ PreventAllMovementWhileInUse

bool MoreMountains.TopDownEngine.Weapon.PreventAllMovementWhileInUse = false

if this is true all movement will be prevented (even flip) while the weapon is active

◆ PreventReloadIfAmmoEmpty

bool MoreMountains.TopDownEngine.Weapon.PreventReloadIfAmmoEmpty = false

if this is true, the weapon won't try and reload if the ammo is empty, when using WeaponAmmo

◆ RecoilForce

float MoreMountains.TopDownEngine.Weapon.RecoilForce = 0f

the force to apply to push the character back when shooting - positive values will push the character back, negative values will launch it forward, turning that recoil into a thrust

◆ ReloadAnimationParameter

string MoreMountains.TopDownEngine.Weapon.ReloadAnimationParameter

the name of the weapon reload animation parameter

◆ ReloadStartAnimationParameter

string MoreMountains.TopDownEngine.Weapon.ReloadStartAnimationParameter

the name of the weapon reload start animation parameter

◆ ReloadStopAnimationParameter

string MoreMountains.TopDownEngine.Weapon.ReloadStopAnimationParameter

the name of the weapon reload end animation parameter

◆ ReloadTime

float MoreMountains.TopDownEngine.Weapon.ReloadTime = 2f

the time it takes to reload the weapon

◆ RightFacingFlipValue

Vector3 MoreMountains.TopDownEngine.Weapon.RightFacingFlipValue = new Vector3(1, 1, 1)

the FlipValue will be used to multiply the model's transform's localscale on flip. Usually it's -1,1,1, but feel free to change it to suit your model's specs

◆ RightHandHandle

Transform MoreMountains.TopDownEngine.Weapon.RightHandHandle

the transform to which the character's right hand should be attached to

◆ SingleUseAnimationParameter

string MoreMountains.TopDownEngine.Weapon.SingleUseAnimationParameter

the name of the weapon's single use animation parameter : true at each frame the weapon activates (shoots)

◆ StartAnimationParameter

string MoreMountains.TopDownEngine.Weapon.StartAnimationParameter

the name of the weapon's start animation parameter : true at the frame where the weapon starts being used

◆ StopAnimationParameter

string MoreMountains.TopDownEngine.Weapon.StopAnimationParameter

the name of the weapon stop animation parameter : true after a shot and before the next one or the weapon's stop

◆ TimeBetweenUses

float MoreMountains.TopDownEngine.Weapon.TimeBetweenUses = 1f

the time (in seconds) between two shots

◆ TimeBetweenUsesReleaseInterruption

bool MoreMountains.TopDownEngine.Weapon.TimeBetweenUsesReleaseInterruption = true

whether or not the time between uses can be interrupted by releasing the shoot button (if true, releasing the button will cancel the time between uses)

◆ TriggerMode

TriggerModes MoreMountains.TopDownEngine.Weapon.TriggerMode = TriggerModes.Auto

is this weapon on semi or full auto ?

◆ UseAnimationParameter

string MoreMountains.TopDownEngine.Weapon.UseAnimationParameter

the name of the weapon's in use animation parameter : true at each frame the weapon has started firing but hasn't stopped yet

◆ UseBurstMode

bool MoreMountains.TopDownEngine.Weapon.UseBurstMode = false

if this is true, the weapon will activate repeatedly for every shoot request

◆ WeaponAngleAnimationParameter

string MoreMountains.TopDownEngine.Weapon.WeaponAngleAnimationParameter

the name of the weapon's angle animation parameter

◆ WeaponAngleRelativeAnimationParameter

string MoreMountains.TopDownEngine.Weapon.WeaponAngleRelativeAnimationParameter

the name of the weapon's angle animation parameter, adjusted so it's always relative to the direction the character is currently facing

◆ WeaponAnimationID

int MoreMountains.TopDownEngine.Weapon.WeaponAnimationID = 0

the ID of the weapon to pass to the animator

◆ WeaponAttachmentOffset

Vector3 MoreMountains.TopDownEngine.Weapon.WeaponAttachmentOffset = Vector3.zero

an offset that will be applied to the weapon once attached to the center of the WeaponAttachment transform.

◆ WeaponCurrentlyActive

bool MoreMountains.TopDownEngine.Weapon.WeaponCurrentlyActive = true

whether or not the weapon is currently active

◆ WeaponName

string MoreMountains.TopDownEngine.Weapon.WeaponName

the name of the weapon, only used for debugging

◆ WeaponReloadImpossibleMMFeedback

MMFeedbacks MoreMountains.TopDownEngine.Weapon.WeaponReloadImpossibleMMFeedback

the feedback to play when the weapon can't reload as there's no more ammo available. You'll need PreventReloadIfAmmoEmpty to be true for this to work

◆ WeaponReloadMMFeedback

MMFeedbacks MoreMountains.TopDownEngine.Weapon.WeaponReloadMMFeedback

the feedback to play when the weapon gets reloaded

◆ WeaponReloadNeededMMFeedback

MMFeedbacks MoreMountains.TopDownEngine.Weapon.WeaponReloadNeededMMFeedback

the feedback to play when the weapon gets reloaded

◆ WeaponShouldFlip

bool MoreMountains.TopDownEngine.Weapon.WeaponShouldFlip = true

if this is true, the weapon will flip to match the character's orientation

◆ WeaponStartMMFeedback

MMFeedbacks MoreMountains.TopDownEngine.Weapon.WeaponStartMMFeedback

the feedback to play when the weapon starts being used

◆ WeaponState

MMStateMachine<WeaponStates> MoreMountains.TopDownEngine.Weapon.WeaponState

the weapon's state machine

◆ WeaponStopMMFeedback

MMFeedbacks MoreMountains.TopDownEngine.Weapon.WeaponStopMMFeedback

the feedback to play when the weapon stops being used

◆ WeaponUsedMMFeedback

MMFeedbacks MoreMountains.TopDownEngine.Weapon.WeaponUsedMMFeedback

the feedback to play while the weapon is in use

◆ WeaponUsedMMFeedbackAlt

MMFeedbacks MoreMountains.TopDownEngine.Weapon.WeaponUsedMMFeedbackAlt

if set, this feedback will be used randomly instead of WeaponUsedMMFeedback

◆ WeaponUseTransform

Transform MoreMountains.TopDownEngine.Weapon.WeaponUseTransform

a transform to use as the spawn point for weapon use (if null, only offset will be considered, otherwise the transform without offset)

Property Documentation

◆ CharacterHandleWeapon

virtual CharacterHandleWeapon MoreMountains.TopDownEngine.Weapon.CharacterHandleWeapon
getset

the weapon's owner's CharacterHandleWeapon component

◆ MovementMultiplierStorage

float MoreMountains.TopDownEngine.Weapon.MovementMultiplierStorage
getset

◆ Owner

virtual Character MoreMountains.TopDownEngine.Weapon.Owner
getprotected set

the weapon's owner

◆ WeaponAmmo

virtual WeaponAmmo MoreMountains.TopDownEngine.Weapon.WeaponAmmo
getprotected set

the WeaponAmmo component optionnally associated to this weapon

◆ WeaponID

virtual string MoreMountains.TopDownEngine.Weapon.WeaponID
getset

the name of the inventory item corresponding to this weapon. Automatically set (if needed) by InventoryEngineWeapon


The documentation for this class was generated from the following file: