Corgi Engine  v8.8
MoreMountains.CorgiEngine.CharacterHandleWeapon Class Reference

Add this class to a character so it can use weapons Note that this component will trigger animations (if their parameter is present in the Animator), based on the current weapon's Animations Animator parameters : defined from the Weapon's inspector More...

Inheritance diagram for MoreMountains.CorgiEngine.CharacterHandleWeapon:
MoreMountains.CorgiEngine.CharacterAbility MoreMountains.CorgiEngine.CorgiMonoBehaviour MoreMountains.CorgiEngine.CharacterHandleSecondaryWeapon

Public Member Functions

override string HelpBoxText ()
 This method is only used to display a helpbox text at the beginning of the ability's inspector. More...
 
virtual void Setup ()
 Grabs various components and inits stuff More...
 
override void ProcessAbility ()
 Every frame we check if it's needed to update the ammo display More...
 
virtual void ShootStart ()
 Causes the character to start shooting More...
 
virtual void ShootStop ()
 Causes the character to stop shooting More...
 
virtual void ForceStop ()
 A method used (usually by AIs) to force the weapon to stop More...
 
virtual void Reload ()
 Reloads the weapon More...
 
virtual void ChangeWeapon (Weapon newWeapon, string weaponID, bool combo=false)
 Changes the character's current weapon to the one passed as a parameter More...
 
override void Flip ()
 Flips the current weapon if needed More...
 
virtual void UpdateAmmoDisplay ()
 Updates the ammo display bar and text. More...
 
override void ResetAbility ()
 On reset ability, we cancel all the changes made More...
 
- Public Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual void SetInputManager (InputManager inputManager)
 Sets a new input manager for this ability to get input from More...
 
virtual void BindAnimator ()
 Binds the animator from the character and initializes the animator parameters More...
 
virtual void ResetInput ()
 Resets all input for this ability. Can be overridden for ability specific directives More...
 
virtual void EarlyProcessAbility ()
 The first of the 3 passes you can have in your ability. Think of it as EarlyUpdate() if it existed More...
 
virtual void LateProcessAbility ()
 The last of the 3 passes you can have in your ability. Think of it as LateUpdate() 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...
 
virtual void PermitAbility (bool abilityPermitted)
 Changes the status of the ability's permission More...
 
virtual void PlayAbilityStartFeedbacks ()
 Plays the ability start sound effect More...
 
virtual void StopStartFeedbacks ()
 Stops the ability used sound effect More...
 
virtual void PlayAbilityStopFeedbacks ()
 Plays the ability stop sound effect More...
 
virtual void RegisterAnimatorParameter (string parameterName, AnimatorControllerParameterType parameterType, out int parameter)
 Registers a new animator parameter to the list More...
 

Public Attributes

Weapon InitialWeapon
 the initial weapon owned by the character More...
 
bool CanPickupWeapons = true
 if this is set to true, the character can pick up PickableWeapons More...
 
Transform WeaponAttachment
 the position the weapon will be attached to. If left blank, will be this.transform. More...
 
bool ForceWeaponScaleResetOnEquip = false
 if this is true, the weapon's scale will be forced to 1,1,1 when equipped More...
 
bool ForceWeaponRotationResetOnEquip = false
 if this is true, the weapon's rotation will be forced to Identity when equipped More...
 
bool AutomaticallyBindAnimator = true
 if this is true this animator will be automatically bound to the weapon More...
 
int AmmoDisplayID = 0
 the ID of the AmmoDisplay this ability should update More...
 
bool ContinuousPress = false
 if this is true you won't have to release your fire button to auto reload More...
 
bool GettingHitInterruptsAttack = false
 whether or not this character getting hit should interrupt its attack (will only work if the weapon is marked as interruptable) More...
 
bool CanShootFromLadders = false
 whether or not this character is allowed to shoot while on a ladder) More...
 
bool FaceWeaponDirection = false
 if this is set to true, the character will be forced to face the current weapon direction More...
 
bool InvertHorizontalAimWhenWallclinging = false
 if this is true, horizontal aim will be inverted when shooting while wallclinging, to shoot away from the wall More...
 
bool ForceAlwaysShoot = false
 if this is true, the character will continuously fire its weapon More...
 
bool BufferInput
 whether or not attack input should be buffered, letting you prepare an attack while another is being performed, making it easier to chain them More...
 
bool NewInputExtendsBuffer
 if this is true, every new input will prolong the buffer More...
 
float MaximumBufferDuration = 0.25f
 the maximum duration for the buffer, in seconds More...
 
Weapon CurrentWeapon
 returns the current equipped weapon More...
 
- Public Attributes inherited from MoreMountains.CorgiEngine.CharacterAbility
MMFeedbacks AbilityStartFeedbacks
 the feedbacks to play when the ability starts More...
 
MMFeedbacks AbilityStopFeedbacks
 the feedbacks to play when the ability stops More...
 
bool AbilityPermitted = true
 if true, this ability can perform as usual, if not, it'll be ignored. You can use this to unlock abilities over time for example More...
 
CharacterStates.MovementStates[] BlockingMovementStates
 an array containing all the blocking movement states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while Idle or Swimming, for example. More...
 
CharacterStates.CharacterConditions[] BlockingConditionStates
 an array containing all the blocking condition states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while dead, for example. More...
 
Weapon.WeaponStates[] BlockingWeaponStates
 an array containing all the blocking weapon states. If one of the character's weapons is in one of these states and yet the character tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while attacking, for example. More...
 

Protected Member Functions

override void Initialization ()
 Gets and stores components for further use More...
 
virtual void HandleWeaponStop ()
 Checks for state changes to trigger stop feedbacks More...
 
virtual void HandleFacingDirection ()
 If FaceWeaponDirection is true, will force the character to face the weapon direction More...
 
override void HandleInput ()
 Gets input and triggers methods based on what's been pressed More...
 
virtual void HandleBuffer ()
 Triggers an attack if the weapon is idle and an input has been buffered More...
 
override void OnRespawn ()
 On respawn we setup our weapon again More...
 
override void OnHit ()
 On hit we interrupt our weapon if needed More...
 
override void OnDeath ()
 On death we stop shooting if needed More...
 
- Protected Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual void Start ()
 On Start(), we call the ability's intialization More...
 
virtual void InitializeAnimatorParameters ()
 Adds required animator parameters to the animator parameters list if they exist More...
 
virtual void InternalHandleInput ()
 Internal method to check if an input manager is present or not More...
 
virtual void OnEnable ()
 On enable, we bind our respawn delegate More...
 
virtual void OnDisable ()
 On disable, we unbind our respawn delegate More...
 

Protected Attributes

float _fireTimer = 0f
 
float _secondaryHorizontalMovement
 
float _secondaryVerticalMovement
 
WeaponAim _aimableWeapon
 
ProjectileWeapon _projectileWeapon
 
WeaponIK _weaponIK
 
Transform _leftHandTarget = null
 
Transform _rightHandTarget = null
 
float _bufferEndsAt = 0f
 
bool _buffering = false
 
bool _charHztlMvmtFlipInitialSetting
 
bool _charHztlMvmtFlipInitialSettingSet = false
 
Vector2 _invertedHorizontalAimMultiplier = new Vector2(-1f, 1f)
 
- Protected Attributes inherited from MoreMountains.CorgiEngine.CharacterAbility
Character _character
 
Transform _characterTransform
 
Health _health
 
CharacterHorizontalMovement _characterHorizontalMovement
 
CorgiController _controller
 
InputManager _inputManager
 
CameraController _sceneCamera
 
Animator _animator
 
CharacterStates _state
 
SpriteRenderer _spriteRenderer
 
MMStateMachine< CharacterStates.MovementStates_movement
 
MMStateMachine< CharacterStates.CharacterConditions_condition
 
bool _abilityInitialized = false
 
CharacterGravity _characterGravity
 
float _verticalInput
 
float _horizontalInput
 
bool _startFeedbackIsPlaying = false
 
List< CharacterHandleWeapon_handleWeaponList
 

Properties

virtual int HandleWeaponID [get]
 
Animator CharacterAnimator [get, set]
 
- Properties inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual bool AbilityAuthorized [get]
 
virtual bool AbilityInitialized [get]
 true if the ability has already been initialized More...
 

Detailed Description

Add this class to a character so it can use weapons Note that this component will trigger animations (if their parameter is present in the Animator), based on the current weapon's Animations Animator parameters : defined from the Weapon's inspector

Member Function Documentation

◆ ChangeWeapon()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.ChangeWeapon ( Weapon  newWeapon,
string  weaponID,
bool  combo = false 
)
virtual

Changes the character's current weapon to the one passed as a parameter

Parameters
newWeaponThe new weapon.

◆ Flip()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.Flip ( )
virtual

Flips the current weapon if needed

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ForceStop()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.ForceStop ( )
virtual

A method used (usually by AIs) to force the weapon to stop

◆ HandleBuffer()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.HandleBuffer ( )
protectedvirtual

Triggers an attack if the weapon is idle and an input has been buffered

◆ HandleFacingDirection()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.HandleFacingDirection ( )
protectedvirtual

If FaceWeaponDirection is true, will force the character to face the weapon direction

◆ HandleInput()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.HandleInput ( )
protectedvirtual

Gets input and triggers methods based on what's been pressed

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ HandleWeaponStop()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.HandleWeaponStop ( )
protectedvirtual

Checks for state changes to trigger stop feedbacks

◆ HelpBoxText()

override string MoreMountains.CorgiEngine.CharacterHandleWeapon.HelpBoxText ( )
virtual

This method is only used to display a helpbox text at the beginning of the ability's inspector.

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ Initialization()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.Initialization ( )
protectedvirtual

Gets and stores components for further use

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ OnDeath()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.OnDeath ( )
protectedvirtual

On death we stop shooting if needed

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ OnHit()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.OnHit ( )
protectedvirtual

On hit we interrupt our weapon if needed

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ OnRespawn()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.OnRespawn ( )
protectedvirtual

On respawn we setup our weapon again

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ProcessAbility()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.ProcessAbility ( )
virtual

Every frame we check if it's needed to update the ammo display

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ Reload()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.Reload ( )
virtual

Reloads the weapon

◆ ResetAbility()

override void MoreMountains.CorgiEngine.CharacterHandleWeapon.ResetAbility ( )
virtual

On reset ability, we cancel all the changes made

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ Setup()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.Setup ( )
virtual

Grabs various components and inits stuff

◆ ShootStart()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.ShootStart ( )
virtual

Causes the character to start shooting

◆ ShootStop()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.ShootStop ( )
virtual

Causes the character to stop shooting

◆ UpdateAmmoDisplay()

virtual void MoreMountains.CorgiEngine.CharacterHandleWeapon.UpdateAmmoDisplay ( )
virtual

Updates the ammo display bar and text.

Member Data Documentation

◆ _aimableWeapon

WeaponAim MoreMountains.CorgiEngine.CharacterHandleWeapon._aimableWeapon
protected

◆ _bufferEndsAt

float MoreMountains.CorgiEngine.CharacterHandleWeapon._bufferEndsAt = 0f
protected

◆ _buffering

bool MoreMountains.CorgiEngine.CharacterHandleWeapon._buffering = false
protected

◆ _charHztlMvmtFlipInitialSetting

bool MoreMountains.CorgiEngine.CharacterHandleWeapon._charHztlMvmtFlipInitialSetting
protected

◆ _charHztlMvmtFlipInitialSettingSet

bool MoreMountains.CorgiEngine.CharacterHandleWeapon._charHztlMvmtFlipInitialSettingSet = false
protected

◆ _fireTimer

float MoreMountains.CorgiEngine.CharacterHandleWeapon._fireTimer = 0f
protected

◆ _invertedHorizontalAimMultiplier

Vector2 MoreMountains.CorgiEngine.CharacterHandleWeapon._invertedHorizontalAimMultiplier = new Vector2(-1f, 1f)
protected

◆ _leftHandTarget

Transform MoreMountains.CorgiEngine.CharacterHandleWeapon._leftHandTarget = null
protected

◆ _projectileWeapon

ProjectileWeapon MoreMountains.CorgiEngine.CharacterHandleWeapon._projectileWeapon
protected

◆ _rightHandTarget

Transform MoreMountains.CorgiEngine.CharacterHandleWeapon._rightHandTarget = null
protected

◆ _secondaryHorizontalMovement

float MoreMountains.CorgiEngine.CharacterHandleWeapon._secondaryHorizontalMovement
protected

◆ _secondaryVerticalMovement

float MoreMountains.CorgiEngine.CharacterHandleWeapon._secondaryVerticalMovement
protected

◆ _weaponIK

WeaponIK MoreMountains.CorgiEngine.CharacterHandleWeapon._weaponIK
protected

◆ AmmoDisplayID

int MoreMountains.CorgiEngine.CharacterHandleWeapon.AmmoDisplayID = 0

the ID of the AmmoDisplay this ability should update

◆ AutomaticallyBindAnimator

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.AutomaticallyBindAnimator = true

if this is true this animator will be automatically bound to the weapon

◆ BufferInput

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.BufferInput

whether or not attack input should be buffered, letting you prepare an attack while another is being performed, making it easier to chain them

◆ CanPickupWeapons

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.CanPickupWeapons = true

if this is set to true, the character can pick up PickableWeapons

◆ CanShootFromLadders

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.CanShootFromLadders = false

whether or not this character is allowed to shoot while on a ladder)

◆ ContinuousPress

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.ContinuousPress = false

if this is true you won't have to release your fire button to auto reload

◆ CurrentWeapon

Weapon MoreMountains.CorgiEngine.CharacterHandleWeapon.CurrentWeapon

returns the current equipped weapon

◆ FaceWeaponDirection

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.FaceWeaponDirection = false

if this is set to true, the character will be forced to face the current weapon direction

◆ ForceAlwaysShoot

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.ForceAlwaysShoot = false

if this is true, the character will continuously fire its weapon

◆ ForceWeaponRotationResetOnEquip

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.ForceWeaponRotationResetOnEquip = false

if this is true, the weapon's rotation will be forced to Identity when equipped

◆ ForceWeaponScaleResetOnEquip

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.ForceWeaponScaleResetOnEquip = false

if this is true, the weapon's scale will be forced to 1,1,1 when equipped

◆ GettingHitInterruptsAttack

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.GettingHitInterruptsAttack = false

whether or not this character getting hit should interrupt its attack (will only work if the weapon is marked as interruptable)

◆ InitialWeapon

Weapon MoreMountains.CorgiEngine.CharacterHandleWeapon.InitialWeapon

the initial weapon owned by the character

◆ InvertHorizontalAimWhenWallclinging

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.InvertHorizontalAimWhenWallclinging = false

if this is true, horizontal aim will be inverted when shooting while wallclinging, to shoot away from the wall

◆ MaximumBufferDuration

float MoreMountains.CorgiEngine.CharacterHandleWeapon.MaximumBufferDuration = 0.25f

the maximum duration for the buffer, in seconds

◆ NewInputExtendsBuffer

bool MoreMountains.CorgiEngine.CharacterHandleWeapon.NewInputExtendsBuffer

if this is true, every new input will prolong the buffer

◆ WeaponAttachment

Transform MoreMountains.CorgiEngine.CharacterHandleWeapon.WeaponAttachment

the position the weapon will be attached to. If left blank, will be this.transform.

Property Documentation

◆ CharacterAnimator

Animator MoreMountains.CorgiEngine.CharacterHandleWeapon.CharacterAnimator
getset

◆ HandleWeaponID

virtual int MoreMountains.CorgiEngine.CharacterHandleWeapon.HandleWeaponID
get

the ID / index of this CharacterHandleWeapon. This will be used to determine what handle weapon ability should equip a weapon. If you create more Handle Weapon abilities, make sure to override and increment this


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