Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.BasicAttacks Class Reference

Handles the setup of basic single button attacks for air and ground. This is a "special" movement. It derives from movement but has a lot of additional functionality. More...

Inheritance diagram for PlatformerPro.BasicAttacks:
PlatformerPro.Movement PlatformerPro.BasicAttacksWithAutoFire PlatformerPro.BlockAttack PlatformerPro.ComboAttacks PlatformerPro.DashAttack PlatformerPro.MultiProjectileAttacks PlatformerPro.PowerBombAttack

Public Member Functions

override Movement Init (Character character)
 Initialise this movement and retyrn a reference to the ready to use movement. More...
 
virtual float GetRawChargeForAttack (int index)
 Gets the charge level for a given attack (by index). Returns -1 if not charging. Does not process through the digital charge filters if present. More...
 
virtual float GetChargeForAttack (int index)
 Gets the charge level for a given attack (by index). Returns -1 if not charging. More...
 
virtual int GetIndexForName (string name)
 Gets the index of the givne atack in the attack data or -1 if no match found. More...
 
virtual bool WantsAttack ()
 Gets a value indicating whether this movement wants to initiate an attack. More...
 
virtual bool WantsToSetAnimationState ()
 Gets a value indicating whether this movement wants to set the animation state. More...
 
virtual bool Attack ()
 Do whichever attack is available. More...
 
virtual void InterruptAttack ()
 Forces an attack to stop More...
 
virtual void HitEnemy (IMob enemy, DamageInfo info)
 Called when the character hits an enemy. More...
 
virtual float GetAttackCoolDown (int attackIndex)
 Gets the cool down time for an attack. More...
 
virtual float GetAttackCoolDownRemaining (int attackIndex)
 Gets the remaining cool down time for an attack. More...
 
virtual void EnableHitBox ()
 Enable the current attacks hit box immediately. Usually used when using animation events to enable hitboxes. More...
 
virtual void DisableHitBox ()
 Disable the current attacks hit box immediately. Usually used when using animation events to enable hitboxes. More...
 
virtual void InstantiateProjectile ()
 Instantiates the deferred projectile. More...
 
virtual void InstantiateProjectile (int attackIndex)
 Instatiates a projectile. More...
 
virtual void FirePreparedProjectile ()
 Fired a previously prepared projectile. More...
 
virtual int GetAttackDamage (BasicAttackData data)
 Gets the attack damage including modifiers More...
 
virtual float GetAttackTime (BasicAttackData data)
 Gets the attack time including modifiers More...
 
virtual float GetAttackTime (float baseTime)
 
override bool ForceMaintainControl ()
 If the attack is in progress force control. More...
 
virtual bool BlockJump ()
 Should we block jumping movement? More...
 
virtual bool BlockWall ()
 Should we block wall movement? More...
 
virtual bool BlockClimb ()
 Should we block climb movement? More...
 
virtual bool BlockSpecial ()
 Should we block climb movement? More...
 
- Public Member Functions inherited from PlatformerPro.Movement
virtual Movement Init (Character character, MovementVariable[] movementData)
 Initialise the movement with the given movement data. More...
 
virtual string PostInitValidation ()
 Called after initialisation to check if this movement is configured correctly. Typically used to stop wrapper movements being the default and ending up in infinite loops. More...
 
virtual void DoMove ()
 Moves the character. More...
 
virtual void PostCollisionDoMove ()
 Does any movement that MUST be done after collissions are calculated. More...
 
virtual bool CheckAdditionalConditions ()
 If this is true then the movement wants to maintain control of the character even if default transition conditions suggest it shouldn't. More...
 
virtual void ConditionsActivated ()
 Call activated on each condition. More...
 
virtual void GainControl ()
 Called when the movement gets control. Typically used to do initialisation of velocity and the like. More...
 
virtual void LosingControl ()
 Called when the movement loses control. Override to do any reset type actions. More...
 
virtual bool IsGrounded ()
 Determines whether this character is grounded. Only applied if ShouldDoBaseCollisions returned false this frame. Else the IsGrounded() method from the base collisions will be used. More...
 

Public Attributes

List< BasicAttackDataattacks
 The attack data. More...
 
bool attackSystemWantsMovementControl
 Does the attack also override movement. If false then the attack system will not control movement and animations handling will depend on attackSystemWantsAnimationStateOverride. More...
 
bool attackSystemWantsAnimationStateOverride
 Does the attack override animation. If false then the attack system will only set an animation override not an animation state. More...
 
- Public Attributes inherited from PlatformerPro.Movement
bool skipEquipmentMultipliers
 If true don't apply equipment multipliers to this movement. More...
 
bool skipUpgradeMultipliers
 If true don't apply upgrade multipliers to this movement. More...
 
bool skipPowerUpMultipliers
 If true don't apply power-up multipliers to this movement. More...
 

Protected Member Functions

virtual void PostInit ()
 Init this instance. More...
 
virtual bool CheckLocation (BasicAttackData attackData)
 Is the character in the right place for the given attack. More...
 
virtual bool CheckInput (BasicAttackData attackData)
 Is the input correct for the given attack. This implmenetation is simple a key press, but another could be more complex (queueable combo attacks, or complex key combinations). More...
 
virtual bool CheckAmmo (BasicAttackData attackData)
 Checks that the player has enough ammo to fire. More...
 
virtual bool CheckConditions ()
 Checks any additional conditions. More...
 
virtual void ConsumeAmmo (BasicAttackData attackData)
 Consumes ammo. More...
 
virtual void StartAttack (int attackIndex)
 Starts the given attack. More...
 
virtual IEnumerator DoAttack (int attackIndex)
 Do a melee attack. More...
 
virtual IEnumerator DoAnimationSyncedAttack (int attackIndex)
 Do a melee attack with length controlled by the animation. More...
 
virtual void DoAttackStart (int attackIndex)
 Start an attack. More...
 
virtual void DoAttackEnd (int attackIndex)
 Finish an attack. More...
 
virtual IEnumerator DoProjectileAttack (int attackIndex)
 Do a projectile attack. More...
 
virtual void DoPrepare (Projectile projectile, int index)
 Prepares a projectile ready for firing. More...
 
- Protected Member Functions inherited from PlatformerPro.Movement
void AssignReferences (Character character)
 Initialise this movement and return a reference to the ready to use movement. More...
 

Protected Attributes

int currentAttack
 Index of the current attack or -1 if no current attack. More...
 
float currentAttackTimer
 The timer for the current attack. More...
 
ProjectileAimer projectileAimer
 Cached reference to a projectile aimer, or null if there is no aimer. More...
 
int deferredAttackIndex
 The index of the deferred attack. More...
 
ItemManager itemManager
 Cached reference to the item manager used for ammo. More...
 
float[] cooldownTimers
 The cooldown timers. More...
 
float[] chargeTimers
 The charge timers. More...
 
Projectile preparedProjectile
 Cached projectile ready to be fired by animation event. More...
 
Vector2 preparedDirection
 Cached direction ready to be used when projectile fired by animation event. More...
 
int preparedAttackData
 Cached attack data index ready to be used when projectile fired by animation event. More...
 
bool attackAnimationStarted
 Tracks if the state named for the current attacks animation has started playing in the animator. More...
 
- Protected Attributes inherited from PlatformerPro.Movement
Character character
 Cached reference to the character. More...
 
AdditionalCondition[] conditions
 Cached list of all additional conditions. More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
virtual bool IsAttacking [get]
 Gets a value indicating whether this instance is attacking. More...
 
virtual string ActiveAttackName [get]
 Gets the name of the active attack or null if no attack is aactive. More...
 
virtual float ActiveAttackNormalisedTime [get]
 Gets the normalised time of the active attack or -1 if no attack is aactive. More...
 
Animator AttackAnimator [get, set]
 Animator used for calculating attack time. More...
 
int AttackAnimatorLayer [get, set]
 Layer to use for attack animations. More...
 
virtual AttackLocation ActiveAttackLocation [get]
 Gets the active attack location or ANY if no activeattack. More...
 
virtual bool ActiveAttackHasHit [get]
 Returns true if the current attacks hit box has hit an enemy. More...
 
virtual bool CanHaveMultipleAttacks [get]
 Used by the inspector to determine if a given attack can have multiple attacks defined in it. More...
 
virtual bool CanUserSetAttackType [get]
 Used by the inspector to determine if a given attack can have multiple attacks defined in it. More...
 
virtual float Charge [get]
 Gets the cahrge amount. More...
 
override AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
override int AnimationPriority [get]
 Gets the priority of the animation state that this movement wants to set. More...
 
override string OverrideState [get]
 Gets the animation override state that this movement wants to set. More...
 
override bool ShouldApplyGravity [get]
 Gets a value indicating whether this PlatformerPro.Movement expects gravity to be applied after its movement finishes. More...
 
- Properties inherited from PlatformerPro.Movement
virtual Character Character [get]
 Sets the character for this movement. More...
 
virtual bool Enabled [get, set]
 A custom enable which base movements can use to pass on enable values. More...
 
virtual Movement Implementation [get]
 Gets the underlying implementation (if not overridden return itself). More...
 
virtual bool ShouldApplyGravity [get]
 Gets a value indicating whether this PlatformerPro.Movement expects gravity to be applied after its movement finishes. More...
 
virtual float CurrentGravity [get]
 Gets a value indicating the current gravity, only used if this movement doesn't apply the default gravity.

See also
ShouldApplyGravity()
More...
 
virtual RaycastType ShouldDoBaseCollisions [get]
 Gets a value indicating whether this PlatformerPro.Movement expects the base collisions to be executed after its movement finishes. More...
 
virtual bool ShouldDoRotations [get]
 Gets a value indicating whether this PlatformerPro.Movement expects the rotations to be calculated and applied by the character. More...
 
virtual AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
virtual string OverrideState [get]
 Gets the animation override state that this movement wants to set. More...
 
virtual int AnimationPriority [get]
 Gets the priority of the animation state that this movement wants to set. More...
 
virtual int FacingDirection [get]
 Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. More...
 
virtual bool PreventXVelocityReset [get]
 If true then don't allow base collisions to reset velocity in X. More...
 
static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
virtual VelocityType VelocityType [get]
 How does this movement use Velocity. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PlatformerPro.Movement
static bool CheckSideCollisions (Character character, int requiredHits, RaycastType types)
 Utility method which checks for side collissions. More...
 

Detailed Description

Handles the setup of basic single button attacks for air and ground. This is a "special" movement. It derives from movement but has a lot of additional functionality.

Member Function Documentation

◆ Attack()

virtual bool PlatformerPro.BasicAttacks.Attack ( )
virtual

Do whichever attack is available.

Returns
true if this movement wants to main control of movement, false otherwise

Reimplemented in PlatformerPro.PowerBombAttack, PlatformerPro.DashAttack, and PlatformerPro.ComboAttacks.

◆ BlockClimb()

virtual bool PlatformerPro.BasicAttacks.BlockClimb ( )
virtual

Should we block climb movement?

Returns
true, if climb should be blocked, false otherwise.

◆ BlockJump()

virtual bool PlatformerPro.BasicAttacks.BlockJump ( )
virtual

Should we block jumping movement?

Returns
true, if jump should be blocked, false otherwise.

◆ BlockSpecial()

virtual bool PlatformerPro.BasicAttacks.BlockSpecial ( )
virtual

Should we block climb movement?

Returns
true, if jump should be blocked, false otherwise.

◆ BlockWall()

virtual bool PlatformerPro.BasicAttacks.BlockWall ( )
virtual

Should we block wall movement?

Returns
true, if wall cling should be blocked, false otherwise.

◆ CheckAmmo()

virtual bool PlatformerPro.BasicAttacks.CheckAmmo ( BasicAttackData  attackData)
protectedvirtual

Checks that the player has enough ammo to fire.

Returns
true, if ammo was checked, false otherwise.
Parameters
attackDataAttack data.

◆ CheckConditions()

virtual bool PlatformerPro.BasicAttacks.CheckConditions ( )
protectedvirtual

Checks any additional conditions.

Returns
true, if conditions was met, false otherwise.

◆ CheckInput()

virtual bool PlatformerPro.BasicAttacks.CheckInput ( BasicAttackData  attackData)
protectedvirtual

Is the input correct for the given attack. This implmenetation is simple a key press, but another could be more complex (queueable combo attacks, or complex key combinations).

Returns
true, if input was checked, false otherwise.
Parameters
attackDataAttack data.

Reimplemented in PlatformerPro.PowerBombAttack, and PlatformerPro.BasicAttacksWithAutoFire.

◆ CheckLocation()

virtual bool PlatformerPro.BasicAttacks.CheckLocation ( BasicAttackData  attackData)
protectedvirtual

Is the character in the right place for the given attack.

Returns
true, if location was checked, false otherwise.
Parameters
attackDataAttack data.

Reimplemented in PlatformerPro.PowerBombAttack.

◆ ConsumeAmmo()

virtual void PlatformerPro.BasicAttacks.ConsumeAmmo ( BasicAttackData  attackData)
protectedvirtual

Consumes ammo.

Returns
true, if ammo was checked, false otherwise.
Parameters
attackDataAttack data.

◆ DisableHitBox()

virtual void PlatformerPro.BasicAttacks.DisableHitBox ( )
virtual

Disable the current attacks hit box immediately. Usually used when using animation events to enable hitboxes.

◆ DoAnimationSyncedAttack()

virtual IEnumerator PlatformerPro.BasicAttacks.DoAnimationSyncedAttack ( int  attackIndex)
protectedvirtual

Do a melee attack with length controlled by the animation.

Parameters
attackIndexAttack index.

◆ DoAttack()

virtual IEnumerator PlatformerPro.BasicAttacks.DoAttack ( int  attackIndex)
protectedvirtual

Do a melee attack.

Parameters
attackIndexAttack index.

Reimplemented in PlatformerPro.PowerBombAttack.

◆ DoAttackEnd()

virtual void PlatformerPro.BasicAttacks.DoAttackEnd ( int  attackIndex)
protectedvirtual

Finish an attack.

Parameters
attackIndex

◆ DoAttackStart()

virtual void PlatformerPro.BasicAttacks.DoAttackStart ( int  attackIndex)
protectedvirtual

Start an attack.

Parameters
attackIndex

◆ DoPrepare()

virtual void PlatformerPro.BasicAttacks.DoPrepare ( Projectile  projectile,
int  index 
)
protectedvirtual

Prepares a projectile ready for firing.

Parameters
projectileProjectile.
projectileIndex of attack data.

◆ DoProjectileAttack()

virtual IEnumerator PlatformerPro.BasicAttacks.DoProjectileAttack ( int  attackIndex)
protectedvirtual

Do a projectile attack.

Parameters
attackIndexAttack index.

Reimplemented in PlatformerPro.MultiProjectileAttacks.

◆ EnableHitBox()

virtual void PlatformerPro.BasicAttacks.EnableHitBox ( )
virtual

Enable the current attacks hit box immediately. Usually used when using animation events to enable hitboxes.

◆ FirePreparedProjectile()

virtual void PlatformerPro.BasicAttacks.FirePreparedProjectile ( )
virtual

Fired a previously prepared projectile.

◆ ForceMaintainControl()

override bool PlatformerPro.BasicAttacks.ForceMaintainControl ( )
virtual

If the attack is in progress force control.

Reimplemented from PlatformerPro.Movement.

◆ GetAttackCoolDown()

virtual float PlatformerPro.BasicAttacks.GetAttackCoolDown ( int  attackIndex)
virtual

Gets the cool down time for an attack.

Returns
The remaining cool down.
Parameters
attackIndexAttack index.

◆ GetAttackCoolDownRemaining()

virtual float PlatformerPro.BasicAttacks.GetAttackCoolDownRemaining ( int  attackIndex)
virtual

Gets the remaining cool down time for an attack.

Returns
The cool down.
Parameters
attackIndexAttack index.

◆ GetAttackDamage()

virtual int PlatformerPro.BasicAttacks.GetAttackDamage ( BasicAttackData  data)
virtual

Gets the attack damage including modifiers

Returns
The attack damage.
Parameters
dataBase AttackData

◆ GetAttackTime() [1/2]

virtual float PlatformerPro.BasicAttacks.GetAttackTime ( BasicAttackData  data)
virtual

Gets the attack time including modifiers

Returns
The attack damage.
Parameters
dataBase AttackData

◆ GetAttackTime() [2/2]

virtual float PlatformerPro.BasicAttacks.GetAttackTime ( float  baseTime)
virtual

◆ GetChargeForAttack()

virtual float PlatformerPro.BasicAttacks.GetChargeForAttack ( int  index)
virtual

Gets the charge level for a given attack (by index). Returns -1 if not charging.

Returns
The charge level for attack.
Parameters
indexIndex.

◆ GetIndexForName()

virtual int PlatformerPro.BasicAttacks.GetIndexForName ( string  name)
virtual

Gets the index of the givne atack in the attack data or -1 if no match found.

Returns
The index for name.
Parameters
nameName.

◆ GetRawChargeForAttack()

virtual float PlatformerPro.BasicAttacks.GetRawChargeForAttack ( int  index)
virtual

Gets the charge level for a given attack (by index). Returns -1 if not charging. Does not process through the digital charge filters if present.

Returns
The charge level for attack.
Parameters
indexIndex.

◆ HitEnemy()

virtual void PlatformerPro.BasicAttacks.HitEnemy ( IMob  enemy,
DamageInfo  info 
)
virtual

Called when the character hits an enemy.

Parameters
enemyEnemy that was hit.
infoDamage info.

◆ Init()

override Movement PlatformerPro.BasicAttacks.Init ( Character  character)
virtual

Initialise this movement and retyrn a reference to the ready to use movement.

Reimplemented from PlatformerPro.Movement.

◆ InstantiateProjectile() [1/2]

virtual void PlatformerPro.BasicAttacks.InstantiateProjectile ( )
virtual

Instantiates the deferred projectile.

◆ InstantiateProjectile() [2/2]

virtual void PlatformerPro.BasicAttacks.InstantiateProjectile ( int  attackIndex)
virtual

Instatiates a projectile.

Parameters
attackIndexIndex of the projectile to instantiate.

Reimplemented in PlatformerPro.MultiProjectileAttacks.

◆ InterruptAttack()

virtual void PlatformerPro.BasicAttacks.InterruptAttack ( )
virtual

Forces an attack to stop

◆ PostInit()

virtual void PlatformerPro.BasicAttacks.PostInit ( )
protectedvirtual

◆ StartAttack()

virtual void PlatformerPro.BasicAttacks.StartAttack ( int  attackIndex)
protectedvirtual

Starts the given attack.

Parameters
attackIndexAttack index.

Reimplemented in PlatformerPro.PowerBombAttack, and PlatformerPro.MultiProjectileAttacks.

◆ WantsAttack()

virtual bool PlatformerPro.BasicAttacks.WantsAttack ( )
virtual

Gets a value indicating whether this movement wants to initiate an attack.

true if this instance should attack; otherwise, false.

Reimplemented in PlatformerPro.ComboAttacks.

◆ WantsToSetAnimationState()

virtual bool PlatformerPro.BasicAttacks.WantsToSetAnimationState ( )
virtual

Gets a value indicating whether this movement wants to set the animation state.

Returns
true, if wants to set animation state, false otherwise.

Member Data Documentation

◆ attackAnimationStarted

bool PlatformerPro.BasicAttacks.attackAnimationStarted
protected

Tracks if the state named for the current attacks animation has started playing in the animator.

◆ attacks

List<BasicAttackData> PlatformerPro.BasicAttacks.attacks

The attack data.

◆ attackSystemWantsAnimationStateOverride

bool PlatformerPro.BasicAttacks.attackSystemWantsAnimationStateOverride

Does the attack override animation. If false then the attack system will only set an animation override not an animation state.

◆ attackSystemWantsMovementControl

bool PlatformerPro.BasicAttacks.attackSystemWantsMovementControl

Does the attack also override movement. If false then the attack system will not control movement and animations handling will depend on attackSystemWantsAnimationStateOverride.

◆ chargeTimers

float [] PlatformerPro.BasicAttacks.chargeTimers
protected

The charge timers.

◆ cooldownTimers

float [] PlatformerPro.BasicAttacks.cooldownTimers
protected

The cooldown timers.

◆ currentAttack

int PlatformerPro.BasicAttacks.currentAttack
protected

Index of the current attack or -1 if no current attack.

◆ currentAttackTimer

float PlatformerPro.BasicAttacks.currentAttackTimer
protected

The timer for the current attack.

◆ deferredAttackIndex

int PlatformerPro.BasicAttacks.deferredAttackIndex
protected

The index of the deferred attack.

◆ itemManager

ItemManager PlatformerPro.BasicAttacks.itemManager
protected

Cached reference to the item manager used for ammo.

◆ preparedAttackData

int PlatformerPro.BasicAttacks.preparedAttackData
protected

Cached attack data index ready to be used when projectile fired by animation event.

◆ preparedDirection

Vector2 PlatformerPro.BasicAttacks.preparedDirection
protected

Cached direction ready to be used when projectile fired by animation event.

◆ preparedProjectile

Projectile PlatformerPro.BasicAttacks.preparedProjectile
protected

Cached projectile ready to be fired by animation event.

◆ projectileAimer

ProjectileAimer PlatformerPro.BasicAttacks.projectileAimer
protected

Cached reference to a projectile aimer, or null if there is no aimer.

Property Documentation

◆ ActiveAttackHasHit

virtual bool PlatformerPro.BasicAttacks.ActiveAttackHasHit
get

Returns true if the current attacks hit box has hit an enemy.

◆ ActiveAttackLocation

virtual AttackLocation PlatformerPro.BasicAttacks.ActiveAttackLocation
get

Gets the active attack location or ANY if no activeattack.

◆ ActiveAttackName

virtual string PlatformerPro.BasicAttacks.ActiveAttackName
get

Gets the name of the active attack or null if no attack is aactive.

true if active attack name; otherwise, false.

◆ ActiveAttackNormalisedTime

virtual float PlatformerPro.BasicAttacks.ActiveAttackNormalisedTime
get

Gets the normalised time of the active attack or -1 if no attack is aactive.

true if active attack name; otherwise, false.

◆ AnimationPriority

override int PlatformerPro.BasicAttacks.AnimationPriority
get

Gets the priority of the animation state that this movement wants to set.

◆ AnimationState

override AnimationState PlatformerPro.BasicAttacks.AnimationState
get

Gets the animation state that this movement wants to set.

The state of the animation.

◆ AttackAnimator

Animator PlatformerPro.BasicAttacks.AttackAnimator
getset

Animator used for calculating attack time.

◆ AttackAnimatorLayer

int PlatformerPro.BasicAttacks.AttackAnimatorLayer
getset

Layer to use for attack animations.

◆ CanHaveMultipleAttacks

virtual bool PlatformerPro.BasicAttacks.CanHaveMultipleAttacks
get

Used by the inspector to determine if a given attack can have multiple attacks defined in it.

◆ CanUserSetAttackType

virtual bool PlatformerPro.BasicAttacks.CanUserSetAttackType
get

Used by the inspector to determine if a given attack can have multiple attacks defined in it.

◆ Charge

virtual float PlatformerPro.BasicAttacks.Charge
get

Gets the cahrge amount.

The charge.

◆ Info

new static MovementInfo PlatformerPro.BasicAttacks.Info
staticget

Static movement info used by the editor.

◆ IsAttacking

virtual bool PlatformerPro.BasicAttacks.IsAttacking
get

Gets a value indicating whether this instance is attacking.

true if this instance is attacking; otherwise, false.

◆ OverrideState

override string PlatformerPro.BasicAttacks.OverrideState
get

Gets the animation override state that this movement wants to set.

◆ ShouldApplyGravity

override bool PlatformerPro.BasicAttacks.ShouldApplyGravity
get

Gets a value indicating whether this PlatformerPro.Movement expects gravity to be applied after its movement finishes.


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