public void walk()
    {
//        print("PlayerAnimationController walk");


        //mAnimationState.SetAnimation(1, walkName, true);
        // mSkeletonAnimation.AnimationName = walkName;
        // if(mAnimationState.GetCurrent(1).)
        mAnimationState.TimeScale = 2f;


        //if (state != walkName)
        //{
        Spine.TrackEntry now = mAnimationState.GetCurrent(1);
        if (now != null && now.animation != null && now.animation.name == walkName && !now.IsComplete)
        {
            //此时请动画正在执行。
        }
        else
        {
            Spine.TrackEntry entry = mAnimationState.SetAnimation(1, walkName, false);
        }



        //  print("entry is "+entry);
        //}


        // entry.

        state = walkName;
    }
Beispiel #2
0
 private void AnimationState_Complete(Spine.AnimationState state, int trackIndex, int loopCount)
 {
     if (state.GetCurrent(0).animation.name.Equals("dui"))
     {
         SceneMgr.getInstance().popResoult();
     }
     else if (state.GetCurrent(0).animation.name.Equals("cuo"))
     {
         showRightAnswer();
     }
 }
    // returns if the current animation is completed or not, this will return true for looped animations if the time has passed the duration of 1 single complete play.
    public bool IsComplete()
    {
        TrackEntry track = animation.GetCurrent(0);

        if (track != null)
        {
            // time is more then the end time but looping is set to false
            // ** with looping set to true time can be larger then end time.
            if (track.time >= track.EndTime && !track.loop)
            {
                return(true);
            }
        }

        return(false);
    }
Beispiel #4
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (state == null)
        {
            Initialize(animator);
        }

        float      timeScale = stateInfo.speed;
        TrackEntry current   = state.GetCurrent(layerIndex);

        bool transitionPlayed = false;

        if (current != null && fromTransitions.Count > 0)
        {
            transitionPlayed = SetTransition(animator, current, timeScale, layerIndex);
        }

        if (!transitionPlayed && DefaultTransition)
        {
            var transitionEntry = state.SetAnimation(layerIndex, DefaultTransition, false);
            transitionEntry.TimeScale = timeScale;
            transitionPlayed          = true;
        }

        if (transitionPlayed)
        {
            trackEntry = state.AddAnimation(layerIndex, GetAnimmationAsset(animator).Animation, bIsLoop, 0);
        }
        else
        {
            trackEntry = state.SetAnimation(layerIndex, GetAnimmationAsset(animator).Animation, bIsLoop);
        }
        trackEntry.TimeScale = timeScale;
    }
Beispiel #5
0
 void OnAnimaEvent(Spine.AnimationState state, int trackIndex, Spine.Event e)
 {
     if (Event != null)
     {
         Event(state.GetCurrent(trackIndex).Animation.Name, e);
     }
 }
Beispiel #6
0
    // Finds the next empty track and sets it
    private void FindNewFreeTrack()
    {
        int prospectiveTrack = _freeTrackIndex++;

        while (_animState.GetCurrent(prospectiveTrack) != null)
        {
            prospectiveTrack++;
        }
        _freeTrackIndex = prospectiveTrack;
    }
Beispiel #7
0
 static int GetCurrent(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Spine.AnimationState obj = (Spine.AnimationState)ToLua.CheckObject(L, 1, typeof(Spine.AnimationState));
         int arg0           = (int)LuaDLL.luaL_checknumber(L, 2);
         Spine.TrackEntry o = obj.GetCurrent(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (state == null)
        {
            Initialize(animator);
        }

        float timeScale = stateInfo.speed;
        var   current   = state.GetCurrent(layerIndex);

        bool transitionPlayed = false;

        if (current != null && fromTransitions.Count > 0)
        {
            foreach (var t in fromTransitions)
            {
                if (t.from.Animation == current.Animation)
                {
                    var transitionEntry = state.SetAnimation(layerIndex, t.transition.Animation, false);
                    transitionEntry.TimeScale = timeScale;
                    transitionPlayed          = true;
                    break;
                }
            }
        }

        TrackEntry trackEntry;

        if (transitionPlayed)
        {
            trackEntry = state.AddAnimation(layerIndex, animation.Animation, stateInfo.loop, 0);
        }
        else
        {
            trackEntry = state.SetAnimation(layerIndex, animation.Animation, stateInfo.loop);
        }
        trackEntry.TimeScale = timeScale;
    }
Beispiel #9
0
 public void Complete(AnimationState state, int trackIndex, int loopCount)
 {
     Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": complete " + loopCount);
 }
Beispiel #10
0
 public void Event(AnimationState state, int trackIndex, Event e)
 {
     Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e);
 }
 public void Event(AnimationState state, int trackIndex, Event e)
 {
     CCLog.Log(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e);
 }
Beispiel #12
0
        public void Complete(AnimationState state, int trackIndex, int loopCount)
        {
#if !WINDOWS_STOREAPP
            Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": complete " + loopCount);
#endif
        }
 public void Event(Spine.AnimationState state, int trackIndex, Spine.Event e)
 {
     Debug.Log(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e + ", " + e.Int);
 }
 TrackEntry GetCurrent(int layerIndex = 0)
 {
     return(_skeletonState.GetCurrent(layerIndex));
 }
Beispiel #15
0
 public void Complete(AnimationState state, int trackIndex, int loopCount)
 {
     Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": complete " + loopCount);
 }
Beispiel #16
0
 public void Start(object sender, StartEndArgs e)
 {
     Console.WriteLine(e.TrackIndex + " " + state.GetCurrent(e.TrackIndex) + ": start");
 }
 private void CheckTracks()
 {
     Spine.AnimationState animationState = this.skeletonAnimation.AnimationState;
     Debug.Log(animationState.GetCurrent(0));
     Debug.Log(animationState.GetCurrent(1));
 }
Beispiel #18
0
    public float GetAnimationProcess()
    {
        TrackEntry track = state.GetCurrent(0);

        return(track.Time / track.EndTime);
    }
Beispiel #19
0
 public void End(AnimationState state, int trackIndex)
 {
     Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": end");
 }
Beispiel #20
0
 public void End(AnimationState state, int trackIndex)
 {
     Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": end");
 }
Beispiel #21
0
		public void Complete (AnimationState state, int trackIndex, int loopCount) {
#if !WINDOWS_STOREAPP	
			Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": complete " + loopCount);
#endif
		}
Beispiel #22
0
 public void Event(AnimationState state, int trackIndex, Event e)
 {
     Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e);
 }
 public void Start(AnimationState state, int trackIndex)
 {
     CCLog.Log(trackIndex + " " + state.GetCurrent(trackIndex) + ": start");
 }
Beispiel #24
0
		public void Start (AnimationState state, int trackIndex) {
#if !WINDOWS_STOREAPP
			Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": start");
#endif
		}
Beispiel #25
0
 /** Called when the character finishes playing an animation. */
 private void OnComplete(Spine.AnimationState state, int trackIndex)
 {
     // Stores the animation which was just completed.
     string animation = state.GetCurrent(trackIndex).Animation.Name;
 }
Beispiel #26
0
		public void Event (AnimationState state, int trackIndex, Event e) {
#if !WINDOWS_STOREAPP	
			Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e);
#endif
		}
        public void Start(AnimationState state, int trackIndex)
        {
            var entry = state.GetCurrent(trackIndex);
            var animationName = (entry != null && entry.Animation != null) ? entry.Animation.Name : string.Empty;

            CCLog.Log(trackIndex + ":start " + animationName);
        }
Beispiel #28
0
        public void Start(AnimationState state, int trackIndex)
        {
#if !WINDOWS_STOREAPP
            Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": start");
#endif
        }
 public void End(AnimationState state, int trackIndex)
 {
     CCLog.Log(trackIndex + " " + state.GetCurrent(trackIndex) + ": end");
 }
Beispiel #30
0
        public void Event(AnimationState state, int trackIndex, Event e)
        {
#if !WINDOWS_STOREAPP
            Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e);
#endif
        }
 public void Complete(AnimationState state, int trackIndex, int loopCount)
 {
     CCLog.Log(trackIndex + " " + state.GetCurrent(trackIndex) + ": complete " + loopCount);
 }