Iuvo Unity 0.5.1
This is library containing a variety of helper classes and extension methods for the Unity gane engine.
GitHub | Iuvo Unity Updates | Creator
Loading...
Searching...
No Matches
IuvoUnity.Animations.PlayablesHandler Class Reference
Inheritance diagram for IuvoUnity.Animations.PlayablesHandler:
IuvoUnity.Interfaces.IAnimationHandler IuvoUnity.BaseClasses.IuvoInterfaceBase

Public Member Functions

 PlayablesHandler (PlayableGraph graph, AnimationPlayableOutput output)
void Play (string animationName)
void Play (AnimationClip clip)
void Stop ()
void SetBlend (float blendTime)
bool IsPlaying (string animationName)
AnimationClip GetCurrentClip ()

Private Attributes

PlayableGraph graph
AnimationPlayableOutput output
AnimationClipPlayable clipPlayable

Constructor & Destructor Documentation

◆ PlayablesHandler()

IuvoUnity.Animations.PlayablesHandler.PlayablesHandler ( PlayableGraph graph,
AnimationPlayableOutput output )
107 {
108 this.graph = graph;
109 this.output = output;
110 }

References graph, and output.

Member Function Documentation

◆ GetCurrentClip()

AnimationClip IuvoUnity.Animations.PlayablesHandler.GetCurrentClip ( )

Implements IuvoUnity.Interfaces.IAnimationHandler.

146 {
147 if (!clipPlayable.IsValid()) return null;
148 return clipPlayable.GetAnimationClip();
149 }

References clipPlayable.

◆ IsPlaying()

bool IuvoUnity.Animations.PlayablesHandler.IsPlaying ( string animationName)

Implements IuvoUnity.Interfaces.IAnimationHandler.

140 {
141 // Not trivial, you'd need to track currently playing clip manually
142 return false;
143 }

◆ Play() [1/2]

void IuvoUnity.Animations.PlayablesHandler.Play ( AnimationClip clip)

Implements IuvoUnity.Interfaces.IAnimationHandler.

119 {
120 if (clip == null) return;
121 if (clipPlayable.IsValid())
122 clipPlayable.Destroy();
123
124 clipPlayable = AnimationClipPlayable.Create(graph, clip);
125 output.SetSourcePlayable(clipPlayable);
126 graph.Play();
127 }

References clipPlayable, graph, and output.

◆ Play() [2/2]

void IuvoUnity.Animations.PlayablesHandler.Play ( string animationName)

Implements IuvoUnity.Interfaces.IAnimationHandler.

113 {
114 // Playables API usually works with AnimationClip, so you'd need a clip reference
115 // This method might be less useful without clip
116 }

◆ SetBlend()

void IuvoUnity.Animations.PlayablesHandler.SetBlend ( float blendTime)

Implements IuvoUnity.Interfaces.IAnimationHandler.

135 {
136 // Could implement blending by mixing multiple playables, but complex
137 }

◆ Stop()

void IuvoUnity.Animations.PlayablesHandler.Stop ( )

Implements IuvoUnity.Interfaces.IAnimationHandler.

130 {
131 graph.Stop();
132 }

References graph.

Member Data Documentation

◆ clipPlayable

AnimationClipPlayable IuvoUnity.Animations.PlayablesHandler.clipPlayable
private

Referenced by GetCurrentClip(), and Play().

◆ graph

PlayableGraph IuvoUnity.Animations.PlayablesHandler.graph
private

Referenced by Play(), PlayablesHandler(), and Stop().

◆ output

AnimationPlayableOutput IuvoUnity.Animations.PlayablesHandler.output
private

Referenced by Play(), and PlayablesHandler().


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