Liberi
An exergame built for kids with CP!
AnimatorUtils.cs
1 using UnityEngine;
2 
6 public static class AnimatorUtils
7 {
11  public static void RandomizeCurrentAnimation (this Animator self)
12  {
13  self.Play(self.GetCurrentAnimatorStateInfo(0).nameHash, 0, Random.Range(0f, 1f));
14  }
15 
16  public static void CrossFadeSynced (this Animator self, int stateNameHash, float transitionDuration = 0.2f, int layer = -1)
17  {
18  Sync sync = self.GetComponent<Sync>();
19  GameMessage msg = new GameMessage();
20 
21  msg.Write(stateNameHash);
22  msg.Write(transitionDuration);
23  msg.Write(layer);
24 
25  sync.AnimationMessages[0] = msg;
26  }
27 }
A class for serializing game data into a stream for propagation between objects and peers...
Definition: GameMessage.cs:14
This class server two main functions: 1) As a MonoBehaviour, it allows for network synchronization of...
Definition: Sync.cs:13