Class LegionActionPlayer

Namespace
PixelUnitStudio
Assembly
PixelUnitStudio.Runtime.dll

Plays custom actions (LegionAction) on a hero: each step's motion in turn, then back to idle (an action ending in death stays down). Saved hero prefabs carry one that references the action library of their save folder; heroes assembled with LegionBuilder get one from Builder.Actions. While an action plays, LegionEvents.returnToIdle waits for the action to finish. Hit and cast events still fire for every step.

public sealed class LegionActionPlayer : MonoBehaviour
Inheritance
LegionActionPlayer

Constructors

LegionActionPlayer()

public LegionActionPlayer()

Fields

ChannelStart

Starting a channel moves on to its loop by itself, so this step counts loops instead of restarting.

public const string ChannelStart = "cast_start"

Field Value

string

Death

public const string Death = "death"

Field Value

string

Idle

public const string Idle = "idle"

Field Value

string

library

public LegionActionLibrary library

Field Value

LegionActionLibrary

Properties

Current

public LegionAction Current { get; }

Property Value

LegionAction

IsPlaying

public bool IsPlaying { get; }

Property Value

bool

StepIndex

public int StepIndex { get; }

Property Value

int

Methods

Advance()

Moves to the next repeat or step when the current motion has finished. Runs every frame; call it after Animator.Update when stepping by hand.

public void Advance()

Play(LegionAction)

public void Play(LegionAction action)

Parameters

action LegionAction

Play(string)

Plays an action from the library by name. False if the library has no such action.

public bool Play(string actionName)

Parameters

actionName string

Returns

bool

Stop()

Stops the action and leaves the current motion playing.

public void Stop()

Events

Finished

Action that finished playing.

public event Action<LegionAction> Finished

Event Type

Action<LegionAction>

StepStarted

Action and the index of the step that just started.

public event Action<LegionAction, int> StepStarted

Event Type

Action<LegionAction, int>