IsPlaying() public méthode

public IsPlaying ( string name ) : bool
name string
Résultat bool
 static public int IsPlaying(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l);
         System.String         a1;
         checkType(l, 2, out a1);
         var ret = self.IsPlaying(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Exemple #2
0
        public void Update()
        {
            var currentTime = Time.time;

            foreach (var entry in entries.ToArray())
            {
                if (entry.StartTime <= currentTime)
                {
                    entries.Remove(entry);

                    if (entry.OnlyIfNotPlaying)
                    {
                        if (animation.IsPlaying(entry.Name))
                        {
                            continue;
                        }
                    }

                    if (entry.BlendWeight > 0.0f)
                    {
                        animation.Blend(entry.Name, entry.BlendWeight);
                    }
                    else
                    {
                        animation.Play(entry.Name, entry.PlayMode);
                    }

                    animationStartedCallback(entry.Name, animation.GetClip(entry.Name).length);
                }
            }
        }
 static public int IsPlaying(IntPtr l)
 {
     try {
         UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l);
         System.String         a1;
         checkType(l, 2, out a1);
         var ret = self.IsPlaying(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #4
0
        public static void PlayAnimation(this GameObject go, string name = null, State state = State.Play)
        {
            UnityEngine.Animation animation = go.GetComponentInChildren <UnityEngine.Animation>();

            if (animation != null)
            {
                if (string.IsNullOrEmpty(name))
                {
                    name = animation.clip.name;
                }
                switch (state)
                {
                case State.Play:
                {
                    if (animation.isPlaying && animation.IsPlaying(name))
                    {
                    }
                    else
                    {
                        animation.Play(name);
                    }
                }
                break;

                case State.Pause:
                case State.Stop:
                {
                    if (animation.isPlaying && animation.IsPlaying(name))
                    {
                        animation.Stop();
                    }
                }
                break;
                }
            }
        }
 static int QPYX_IsPlaying_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.Animation QPYX_obj_YXQP = (UnityEngine.Animation)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.Animation));
         string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2);
         bool   QPYX_o_YXQP    = QPYX_obj_YXQP.IsPlaying(QPYX_arg0_YXQP);
         LuaDLL.lua_pushboolean(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static public int IsPlaying(IntPtr l)
 {
     try{
         UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l);
         System.String         a1;
         checkType(l, 2, out a1);
         System.Boolean ret = self.IsPlaying(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
    public static IEnumerator ICheckAnimationComplete(Animation targetAnimation, string targetAnimatedName, GameObject callbackObj, string callbackFunction)
    {
        do
        {
            yield return null;
        } while (targetAnimation.IsPlaying(targetAnimatedName));

        Debug.Log(targetAnimatedName + " finish !");

        // here ! call back to delegation obj.
        if (callbackObj != null)
            callbackObj.SendMessage (callbackFunction, SendMessageOptions.DontRequireReceiver);
        else
            OnTargetAnimationComplete_event (EventArgs.Empty);
    }
 static int IsPlaying(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation));
         string arg0 = ToLua.CheckString(L, 2);
         bool   o    = obj.IsPlaying(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 public static int IsPlaying_wrap(long L)
 {
     try
     {
         long nThisPtr             = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Animation obj = get_obj(nThisPtr);
         string arg0    = FCLibHelper.fc_get_string_a(L, 0);
         bool   ret     = obj.IsPlaying(arg0);
         long   ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         FCLibHelper.fc_set_value_bool(ret_ptr, ret);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
Exemple #10
0
    static int IsPlaying(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Animation.IsPlaying");
#endif
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation));
            string arg0 = ToLua.CheckString(L, 2);
            bool   o    = obj.IsPlaying(arg0);
            LuaDLL.lua_pushboolean(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #11
0
 /// <summary>
 /// 判断动作是否播放完毕
 /// </summary>
 /// <param name="animationName"></param>
 /// <returns></returns>
 private bool AnimationStillPlaying(Animation animation, string animationName)
 {
     return animation.IsPlaying(animationName) && animation[animationName].normalizedTime < 1.0f;
 }
 private IEnumerator QueueIdle(Animation source)
 {
     while (source.IsPlaying(_ClipName))
         yield return new WaitForFixedUpdate();
     source.CrossFade(AnimationResources.Idle);
 }
 protected void primaryAnimator(float speed, float time, WrapMode wrap, string name, Animation a)
 {
     if (a != null)
     {
         a[name].speed = speed;
         if (!a.IsPlaying(name))
         {
             a[name].wrapMode = wrap;
             a[name].normalizedTime = time;
             a.Blend(name, 1f);
         }
     }
 }
Exemple #14
0
 private void playAnimation(Animation animation, AnimationClip clip)
 {
     if(!animation.IsPlaying(clip.name)) {
         animation.Play(clip.name);
     }
 }
Exemple #15
0
 private void blendAnimation(Animation animation, AnimationClip clip)
 {
     if(!animation.IsPlaying(clip.name)) {
         animation.Blend(clip.name, 4f);
     }
 }
 private void lightAnimator(Animation a, string name, bool stop)
 {
     if (!a.IsPlaying(name) && !stop)
     {
         a[name].speed = 1f;
         a[name].normalizedTime = 0f;
         a[name].wrapMode = WrapMode.Loop;
         a.Blend(name);
     }
     else if (stop)
     {
         a[name].normalizedTime = a[name].normalizedTime % 1;
         a[name].wrapMode = WrapMode.Clamp;
     }
 }
 //Controls the main, door-opening animation
 private void animator(float speed, float time, Animation a, string name)
 {
     if (a != null)
     {
         a[name].speed = speed;
         if (!a.IsPlaying(name))
         {
             a[name].normalizedTime = time;
             a.Blend(name, 1f);
         }
     }
 }