Corgi Engine  v6.1
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
MoreMountains.CorgiEngine.ProjectileWeapon Class Reference

A weapon class aimed specifically at allowing the creation of various projectile weapons, from shotgun to machine gun, via plasma gun or rocket launcher More...

Inheritance diagram for MoreMountains.CorgiEngine.ProjectileWeapon:
MoreMountains.CorgiEngine.Weapon

Public Member Functions

override void Initialization ()
 Initialize this weapon More...
 
virtual GameObject SpawnProjectile (Vector3 spawnPosition, int projectileIndex, int totalProjectiles, bool triggerObjectActivation=true)
 Spawns a new object and positions/resizes it More...
 
virtual void DetermineSpawnPosition ()
 Determines the spawn position based on the spawn offset and whether or not the weapon is flipped More...
 
- Public Member Functions inherited from MoreMountains.CorgiEngine.Weapon
virtual void InitializeComboWeapons ()
 
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 Interrupt ()
 Call this method to interrupt the weapon 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 InitiateReloadWeapon ()
 
virtual void FlipWeapon ()
 Flips the weapon. More...
 
virtual void FlipWeaponModel ()
 Flips the weapon model. More...
 
virtual IEnumerator WeaponDestruction ()
 Destroys the weapon 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

Transform ProjectileSpawnTransform
 the transform to use as the center reference point of the spawn More...
 
Vector3 ProjectileSpawnOffset = Vector3.zero
 the offset position at which the projectile will spawn More...
 
int ProjectilesPerShot = 1
 the number of projectiles to spawn per shot More...
 
Vector3 Spread = Vector3.zero
 the spread (in degrees) to apply randomly (or not) on each angle when spawning a projectile More...
 
bool RotateWeaponOnSpread = false
 whether or not the weapon should rotate to align with the spread angle More...
 
bool RandomSpread = true
 whether or not the spread should be random (if not it'll be equally distributed) More...
 
Vector3 SpawnPosition = Vector3.zero
 
- Public Attributes inherited from MoreMountains.CorgiEngine.Weapon
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 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...
 
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...
 
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 FlipValue = 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 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 ModifyMovementWhileEquipped = false
 if this is true, a multiplier will be applied to movement while the weapon is equipped More...
 
float PermanentMovementMultiplier = 0f
 the multiplier to apply to movement while equipped 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...
 
List< Animator > Animators
 the other animators (other than the Character's) that you want to update every time this weapon gets used More...
 
string EquippedAnimationParameter
 
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...
 
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 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...
 
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...
 
MMStateMachine< WeaponStatesWeaponState
 the weapon's state machine More...
 

Protected Member Functions

override void WeaponUse ()
 Called everytime the weapon is used More...
 
virtual void OnDrawGizmosSelected ()
 When the weapon is selected, draws a circle at the spawn's position More...
 
- Protected Member Functions inherited from MoreMountains.CorgiEngine.Weapon
virtual void InitializeFeedbacks ()
 
virtual void TurnWeaponOn ()
 Describes what happens when the weapon starts More...
 
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 CaseWeaponIdle ()
 
virtual void CaseWeaponStart ()
 
virtual void CaseWeaponDelayBeforeUse ()
 
virtual void CaseWeaponUse ()
 
virtual void CaseWeaponDelayBetweenUses ()
 
virtual void CaseWeaponStop ()
 
virtual void CaseWeaponReloadNeeded ()
 
virtual void CaseWeaponReloadStart ()
 
virtual void CaseWeaponReload ()
 
virtual void CaseWeaponReloadStop ()
 
virtual void CaseWeaponInterrupted ()
 
virtual void ShootRequest ()
 Determines whether or not the weapon can fire More...
 
virtual void ResetMovementMultiplier ()
 
virtual void ReloadNeeded ()
 Describes what happens when the weapon needs a reload More...
 
virtual void ReloadWeapon ()
 Reloads the weapon More...
 
virtual void ApplyOffset ()
 Applies the offset specified in the inspector 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, List< int > list)
 
virtual void UpdateAnimator (Animator animator, List< int > list)
 

Protected Attributes

Vector3 _flippedProjectileSpawnOffset
 
Vector3 _randomSpreadDirection
 
Vector3 _spawnPositionCenter
 
bool _poolInitialized = false
 
- Protected Attributes inherited from MoreMountains.CorgiEngine.Weapon
SpriteRenderer _spriteRenderer
 
CharacterGravity _characterGravity
 
CorgiController _controller
 
CharacterHorizontalMovement _characterHorizontalMovement
 
WeaponAim _aimableWeapon
 
float _permanentMovementMultiplierStorage = 1f
 
float _movementMultiplierStorage = 1f
 
Animator _ownerAnimator
 
float _delayBeforeUseCounter = 0f
 
float _delayBetweenUsesCounter = 0f
 
float _reloadingCounter = 0f
 
bool _triggerReleased = false
 
bool _reloading = false
 
ComboWeapon _comboWeapon
 
Vector3 _weaponOffset
 
Vector3 _weaponAttachmentOffset
 
Transform _weaponAttachment
 
List< List< int > > _animatorParameters
 
List< int > _ownerAnimatorParameters
 
bool _initialized = false
 
const string _aliveAnimationParameterName = "Alive"
 
int _equippedAnimationParameter
 
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
 

Properties

MMObjectPooler ObjectPooler [get, set]
 
- Properties inherited from MoreMountains.CorgiEngine.Weapon
string WeaponID [get, set]
 the name of the inventory item corresponding to this weapon. Automatically set (if needed) by InventoryEngineWeapon More...
 
Character Owner [get, protected set]
 the weapon's owner More...
 
CharacterHandleWeapon CharacterHandleWeapon [get, set]
 the weapon's owner's CharacterHandleWeapon component More...
 
bool Flipped [get, set]
 if true, the weapon is flipped More...
 
WeaponAmmo WeaponAmmo [get, protected set]
 the WeaponAmmo component optionnally associated to this weapon More...
 

Additional Inherited Members

- Public Types inherited from MoreMountains.CorgiEngine.Weapon
enum  TriggerModes { TriggerModes.SemiAuto, TriggerModes.Auto }
 the possible use modes for the trigger 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...
 

Detailed Description

A weapon class aimed specifically at allowing the creation of various projectile weapons, from shotgun to machine gun, via plasma gun or rocket launcher

Member Function Documentation

◆ DetermineSpawnPosition()

virtual void MoreMountains.CorgiEngine.ProjectileWeapon.DetermineSpawnPosition ( )
virtual

Determines the spawn position based on the spawn offset and whether or not the weapon is flipped

◆ Initialization()

override void MoreMountains.CorgiEngine.ProjectileWeapon.Initialization ( )
virtual

Initialize this weapon

Reimplemented from MoreMountains.CorgiEngine.Weapon.

◆ OnDrawGizmosSelected()

virtual void MoreMountains.CorgiEngine.ProjectileWeapon.OnDrawGizmosSelected ( )
protectedvirtual

When the weapon is selected, draws a circle at the spawn's position

◆ SpawnProjectile()

virtual GameObject MoreMountains.CorgiEngine.ProjectileWeapon.SpawnProjectile ( Vector3  spawnPosition,
int  projectileIndex,
int  totalProjectiles,
bool  triggerObjectActivation = true 
)
virtual

Spawns a new object and positions/resizes it

we get the next object in the pool and make sure it's not null

◆ WeaponUse()

override void MoreMountains.CorgiEngine.ProjectileWeapon.WeaponUse ( )
protectedvirtual

Called everytime the weapon is used

Reimplemented from MoreMountains.CorgiEngine.Weapon.

Member Data Documentation

◆ _flippedProjectileSpawnOffset

Vector3 MoreMountains.CorgiEngine.ProjectileWeapon._flippedProjectileSpawnOffset
protected

◆ _poolInitialized

bool MoreMountains.CorgiEngine.ProjectileWeapon._poolInitialized = false
protected

◆ _randomSpreadDirection

Vector3 MoreMountains.CorgiEngine.ProjectileWeapon._randomSpreadDirection
protected

◆ _spawnPositionCenter

Vector3 MoreMountains.CorgiEngine.ProjectileWeapon._spawnPositionCenter
protected

◆ ProjectileSpawnOffset

Vector3 MoreMountains.CorgiEngine.ProjectileWeapon.ProjectileSpawnOffset = Vector3.zero

the offset position at which the projectile will spawn

◆ ProjectileSpawnTransform

Transform MoreMountains.CorgiEngine.ProjectileWeapon.ProjectileSpawnTransform

the transform to use as the center reference point of the spawn

◆ ProjectilesPerShot

int MoreMountains.CorgiEngine.ProjectileWeapon.ProjectilesPerShot = 1

the number of projectiles to spawn per shot

◆ RandomSpread

bool MoreMountains.CorgiEngine.ProjectileWeapon.RandomSpread = true

whether or not the spread should be random (if not it'll be equally distributed)

◆ RotateWeaponOnSpread

bool MoreMountains.CorgiEngine.ProjectileWeapon.RotateWeaponOnSpread = false

whether or not the weapon should rotate to align with the spread angle

◆ SpawnPosition

Vector3 MoreMountains.CorgiEngine.ProjectileWeapon.SpawnPosition = Vector3.zero

◆ Spread

Vector3 MoreMountains.CorgiEngine.ProjectileWeapon.Spread = Vector3.zero

the spread (in degrees) to apply randomly (or not) on each angle when spawning a projectile

Property Documentation

◆ ObjectPooler

MMObjectPooler MoreMountains.CorgiEngine.ProjectileWeapon.ObjectPooler
getset

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