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.AnimationHandler Class Reference
Inheritance diagram for IuvoUnity.Animations.AnimationHandler:
IuvoUnity.Interfaces.IAnimationHandler IuvoUnity.BaseClasses.IuvoInterfaceBase

Public Member Functions

 AnimationHandler (Animator animator)
void Play (string animationName)
void Play (AnimationClip clip)
void Stop ()
void SetBlend (float blendTime)
bool IsPlaying (string animationName)
AnimationClip GetCurrentClip ()

Private Attributes

Animator animator

Constructor & Destructor Documentation

◆ AnimationHandler()

IuvoUnity.Animations.AnimationHandler.AnimationHandler ( Animator animator)
16 {
17 this.animator = animator;
18 }

References animator.

Member Function Documentation

◆ GetCurrentClip()

AnimationClip IuvoUnity.Animations.AnimationHandler.GetCurrentClip ( )

Implements IuvoUnity.Interfaces.IAnimationHandler.

49 {
50 // Animator API doesn't expose current clip easily
51 // User may track this externally or via AnimationClip array
52 return null;
53 }

◆ IsPlaying()

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

Implements IuvoUnity.Interfaces.IAnimationHandler.

44 {
45 return animator.GetCurrentAnimatorStateInfo(0).IsName(animationName);
46 }

References animator.

◆ Play() [1/2]

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

Implements IuvoUnity.Interfaces.IAnimationHandler.

26 {
27 if (clip == null) return;
28 animator.Play(clip.name);
29 }

References animator.

◆ Play() [2/2]

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

Implements IuvoUnity.Interfaces.IAnimationHandler.

21 {
22 animator.Play(animationName);
23 }

References animator.

◆ SetBlend()

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

Implements IuvoUnity.Interfaces.IAnimationHandler.

37 {
38 // Blend handled by Animator Controller transitions or parameters.
39 // Possibly implement crossfade
40 animator.CrossFade(animator.GetCurrentAnimatorStateInfo(0).shortNameHash, blendTime);
41 }

References animator.

◆ Stop()

void IuvoUnity.Animations.AnimationHandler.Stop ( )

Implements IuvoUnity.Interfaces.IAnimationHandler.

32 {
33 animator.StopPlayback();
34 }

References animator.

Member Data Documentation

◆ animator

Animator IuvoUnity.Animations.AnimationHandler.animator
private

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