예제 #1
0
 private IEnumerator Start()
 {
     do
     {
         SpriterAnimator = GetComponent <SpriterDotNetBehaviour> ().Animator;
         if (SpriterAnimator != null)
         {
             break;
         }
         yield return(null);
     } while (true);
     foreach (var animation in SpriterAnimator.GetAnimations())
     {
         Animations.Add(Animator.StringToHash(animation), animation);
     }
 }
예제 #2
0
    private static string GetAnimation(UnitySpriterAnimator animator, int offset)
    {
        List <string> animations = animator.GetAnimations().ToList();
        int           index      = animations.IndexOf(animator.CurrentAnimation.Name);

        index += offset;
        if (index >= animations.Count)
        {
            index = 0;
        }
        if (index < 0)
        {
            index = animations.Count - 1;
        }
        return(animations[index]);
    }
예제 #3
0
 private static string GetAnimation(UnitySpriterAnimator animator, int offset)
 {
     List<string> animations = animator.GetAnimations().ToList();
     int index = animations.IndexOf(animator.CurrentAnimation.Name);
     index += offset;
     if (index >= animations.Count) index = 0;
     if (index < 0) index = animations.Count - 1;
     return animations[index];
 }
        /// Initialize the animatior
        private void InitAnimator()
        {
            SpriterEntity entity = SpriterData.Spriter.Entities[EntityIndex];
              AudioSource audioSource = gameObject.GetComponent<AudioSource>();

              SpriterAnimator = new UnitySpriterAnimator(entity, ChildData, audioSource);
              RegisterSpritesAndSounds();

              if (UseNativeTags) defaultTag = gameObject.tag;

              if (!String.IsNullOrEmpty(DefaultAnimation)) {
            N.Console.Log("Trying to set animation {0}", DefaultAnimation);
            foreach (var i in SpriterAnimator.GetAnimations()) {
              N.Console.Log(i);
            }
            SpriterAnimator.Transition(DefaultAnimation, 0);
              }
              SpriterAnimator.Step(0);
        }