Loading...
Searching...
No Matches
AdventureCore.PlayableAnimation Class Reference

Detailed Description

plays an animation clip or controller on an animator using a playable graph(like a timeline)
the original animation continues in the background and gets faded out and back in at the end

playing animations that are not part of a characters animator this way allows decoupling actions
for example when the animation for pulling a lever is configured in ObjectAction.CharacterAnimation
any arbitrary (humanoid)character can use that lever without having the animation in its controller

Inheritance diagram for AdventureCore.PlayableAnimation:

Public Member Functions

override void PrepareFrame (Playable playable, FrameData info)
 
void Play ()
 starts or restarts the animation
 
void Cancel ()
 requests for the animation to stop, LeadOut is still done before finishing
 
void Stop ()
 immediately stops the animation
 
void Destroy ()
 destroys the animation
 
virtual void SetTrigger (int id)
 sets a trigger if the animation is playing a controller
 
virtual void SetBool (int id, bool value)
 sets a bool if the animation is playing a controller
 
virtual void SetInt (int id, int value)
 sets an int if the animation is playing a controller
 
virtual void SetFloat (int id, float value)
 sets a float if the animation is playing a controller
 
virtual void SetState (int id)
 plays a state if the animation is playing a controller
 

Static Public Member Functions

static PlayableAnimation Play (PlayableAnimationParameters parameters, Animator target, CharacterBase character=null, Action< PlayableAnimation > finished=null, bool oneShot=true, string name=null)
 creates a new animation and immediately plays it
 
static PlayableAnimation Create (PlayableAnimationParameters parameters, Animator target, CharacterBase character=null, Action< PlayableAnimation > finished=null, bool oneShot=false, string name=null)
 creates a new animation
 

Properties

PlayableAnimationParameters Parameters [get]
 the parameters used to create this animation
 
CharacterBase Character [get]
 character the animation is played on, only used to send instructions
 
Playable Playable [get]
 reference to the playable of this behaviour
 
AnimationClipPlayable Clip [get]
 the playable that provides the animation when playing a clip
 
AnimatorControllerPlayable Controller [get]
 the playable that provides and controls the animation when playing a controller
 
AnimationLayerMixerPlayable MaskMixer [get]
 when a PlayableAnimationParameters.Mask is configured this mixer is used to apply it
 
AnimationPlayableOutput Output [get]
 the playable output for the animation
 
HashSet< int > EndStates [get]
 the PlayableAnimationParameters.EndStates used to determine if the controller is ending in hash form
 
bool IsPlaying [get]
 whether the animation is currently playing
 
bool IsFinished [get]
 whether the animation has fully finished playing
 

Events

Action< PlayableAnimationFinished
 fired when the animation is done playing and has transitioned out
 

Member Function Documentation

◆ Create()

static PlayableAnimation AdventureCore.PlayableAnimation.Create ( PlayableAnimationParameters parameters,
Animator target,
CharacterBase character = null,
Action< PlayableAnimation > finished = null,
bool oneShot = false,
string name = null )
inlinestatic

creates a new animation

Parameters
parametersanimation setting including the animation clip or controller
targetthe animator to play the animation on
finishedexecuted when the animation is finished playing
oneShotwhether the animation is automatically destroyed when finished, when false the animation can be reused but has to be destroyed by the consumer
namename of the graph that is displayed in graph visualizers
Returns
the created animation that is ready to be played

◆ Play()

static PlayableAnimation AdventureCore.PlayableAnimation.Play ( PlayableAnimationParameters parameters,
Animator target,
CharacterBase character = null,
Action< PlayableAnimation > finished = null,
bool oneShot = true,
string name = null )
inlinestatic

creates a new animation and immediately plays it

Parameters
parametersanimation setting including the animation clip or controller
targetthe animator to play the animation on
finishedexecuted when the animation is finished playing
oneShotwhether the animation is automatically destroyed when finished, when false the animation can be reused but has to be destroyed by the consumer
namename of the graph that is displayed in graph visualizers
Returns
the created animation that has been started

◆ SetBool()

virtual void AdventureCore.PlayableAnimation.SetBool ( int id,
bool value )
inlinevirtual

sets a bool if the animation is playing a controller

Parameters
idhashed parameter
valuethe new parameter value

◆ SetFloat()

virtual void AdventureCore.PlayableAnimation.SetFloat ( int id,
float value )
inlinevirtual

sets a float if the animation is playing a controller

Parameters
idhashed parameter
valuethe new parameter value

◆ SetInt()

virtual void AdventureCore.PlayableAnimation.SetInt ( int id,
int value )
inlinevirtual

sets an int if the animation is playing a controller

Parameters
idhashed parameter
valuethe new parameter value

◆ SetState()

virtual void AdventureCore.PlayableAnimation.SetState ( int id)
inlinevirtual

plays a state if the animation is playing a controller

Parameters
idhashed state name

◆ SetTrigger()

virtual void AdventureCore.PlayableAnimation.SetTrigger ( int id)
inlinevirtual

sets a trigger if the animation is playing a controller

Parameters
idhashed parameter