platformer
Public Member Functions | Public Attributes | Protected Attributes | List of all members
UnityPlatformer.CharacterActionTimed Class Reference

Manage actions that has the loop: cast -> duration -> cooldown . More...

Inheritance diagram for UnityPlatformer.CharacterActionTimed:
UnityPlatformer.CharacterAction UnityPlatformer.CharacterActionMelee

Public Member Functions

override void OnEnable ()
 Create Delays More...
 
override void OnDisable ()
 Dispose Delays More...
 
override void GainControl (float delta)
 Start action! More...
 
void Interrupt (bool resetCooldown)
 interrupt current action More...
 
bool IsCasting ()
 in castTime? More...
 
bool IsActionInProgress ()
 after castTime, in durationTime? More...
 
bool IsDone ()
 attack ended More...
 
bool IsCooldown ()
 Can perform action? More...
 
override int WantsToUpdate (float delta)
 Tells the character we want to take control More...
 
- Public Member Functions inherited from UnityPlatformer.CharacterAction
void Reset ()
 Try to set character & input from parent nodes More...
 
virtual void LoseControl (float delta)
 Called (once) when other action 'WantsToUpdate' or this action don't anymore More...
 
abstract void PerformAction (float delta)
 Do your action here. More...
 
abstract PostUpdateActions GetPostUpdateActions ()
 Return what to do next. More...
 

Public Attributes

float castTime = 0
 Casting time More...
 
float durationTime = 1.0f
 Action duration More...
 
float cooldownTime = 3.0f
 Action/Animation duration More...
 
Action onInterrupt
 Notify action is interrupted More...
 
- Public Attributes inherited from UnityPlatformer.CharacterAction
Character character
 Target character that will be affected by this movement More...
 
PlatformerInput input
 Input to listen More...
 
Action onGrainControl
 Callback when this movement WantsToUpdate and has highest priority. More...
 
Action onLoseControl
 Callback when this movement don't WantsToUpdate or another movement has higher priority More...
 

Protected Attributes

Delay casting
 castTime in frames More...
 
Delay inprogress
 durationTime in frames More...
 
Delay cooldown
 cooldownTime in frames More...
 
CharacterActionTimedState state = CharacterActionTimedState.Ready
 Current action state More...
 

Detailed Description

Manage actions that has the loop: cast -> duration -> cooldown .

Timeline explanation:
Character hit the cast action: time = 0 (Play animation if we start casting) action has a castTime. During 0 to castTime we don't deal damage
action has a durationTime. During castTime to castTime + durationTime we deal damage
We have to wail from 0 to cooldownTime to cast again

Member Function Documentation

◆ GainControl()

override void UnityPlatformer.CharacterActionTimed.GainControl ( float  delta)
inlinevirtual

Start action!

Reimplemented from UnityPlatformer.CharacterAction.

◆ Interrupt()

void UnityPlatformer.CharacterActionTimed.Interrupt ( bool  resetCooldown)
inline

interrupt current action

Parameters
resetCooldownReset cooldown. Allow to cast again!

◆ IsActionInProgress()

bool UnityPlatformer.CharacterActionTimed.IsActionInProgress ( )
inline

after castTime, in durationTime?

◆ IsCasting()

bool UnityPlatformer.CharacterActionTimed.IsCasting ( )
inline

in castTime?

◆ IsCooldown()

bool UnityPlatformer.CharacterActionTimed.IsCooldown ( )
inline

Can perform action?

◆ IsDone()

bool UnityPlatformer.CharacterActionTimed.IsDone ( )
inline

attack ended

◆ OnDisable()

override void UnityPlatformer.CharacterActionTimed.OnDisable ( )
inlinevirtual

Dispose Delays

Reimplemented from UnityPlatformer.CharacterAction.

◆ OnEnable()

override void UnityPlatformer.CharacterActionTimed.OnEnable ( )
inlinevirtual

Create Delays

Reimplemented from UnityPlatformer.CharacterAction.

◆ WantsToUpdate()

override int UnityPlatformer.CharacterActionTimed.WantsToUpdate ( float  delta)
inlinevirtual

Tells the character we want to take control

  • Positive numbers fight: Higher number wins
  • Negative numbers are used to ignore fight and force Character to call PerformAction, but! because it doesn't win the fight onLoseControl, onGrainControl and GetPostUpdateActions are ignored.
    NOTE can be used as a replace for UpdateManager.PlatformerUpdate

Implements UnityPlatformer.CharacterAction.

Member Data Documentation

◆ casting

Delay UnityPlatformer.CharacterActionTimed.casting
protected

castTime in frames

◆ castTime

float UnityPlatformer.CharacterActionTimed.castTime = 0

Casting time

Time the character is waving their hands doing no Damage :)
Time before enable the first damage area

◆ cooldown

Delay UnityPlatformer.CharacterActionTimed.cooldown
protected

cooldownTime in frames

◆ cooldownTime

float UnityPlatformer.CharacterActionTimed.cooldownTime = 3.0f

Action/Animation duration

Time after durationTime

◆ durationTime

float UnityPlatformer.CharacterActionTimed.durationTime = 1.0f

Action duration

Duration of the sparks flying around killing people!
Time after castTime

◆ inprogress

Delay UnityPlatformer.CharacterActionTimed.inprogress
protected

durationTime in frames

◆ onInterrupt

Action UnityPlatformer.CharacterActionTimed.onInterrupt

Notify action is interrupted

NOTE It's not used in the library right now, but you can

◆ state

CharacterActionTimedState UnityPlatformer.CharacterActionTimed.state = CharacterActionTimedState.Ready
protected

Current action state


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