GetClipCount() public method

public GetClipCount ( ) : int
return int
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animation>();
     if(anim != null && anim.GetClipCount() > 0)
     {
         anim.wrapMode = WrapMode.Loop;
         clipid = anim.GetClipCount() - 1;
         anim.Play("" + clipid);
     }
 }
 static public int GetClipCount(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);
         var ret = self.GetClipCount();
         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
 }
    // Use this for initialization
    void Start()
    {
        m_Animation = GetComponent<Animation>();
        On = m_Animation.GetClipCount() - 1;
        m_CurrentKeyState = Off;

        m_Animation.wrapMode = WrapMode.ClampForever;
        m_Animation.Play(""+ m_CurrentKeyState);
    }
 static public int GetClipCount(IntPtr l)
 {
     try {
         UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l);
         var ret = self.GetClipCount();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    //public void Move(int InputAxis)
    //{
    //    directionInput = InputAxis;
    //    GetComponent<Rigidbody2D>().velocity = new Vector2(InputAxis * maxSpeed, GetComponent<Rigidbody2D>().velocity.y);
    //}

    //public void Jump(bool IsJump)
    //{
    //    if (!grounded)
    //        return;
    //    if (grounded)
    //    {
    //        GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, jumpForce));
    //    }
    //}

    void Awake()
    {
        anim = GetComponent<Animation>();
        respawnPoint = transform.position;

        animations = new string[anim.GetClipCount()];
        int i = 0;
        foreach (AnimationState a in anim)
        {
            animations[i] = a.name;
            i++;
        }
    }
 static public int GetClipCount(IntPtr l)
 {
     try{
         UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l);
         System.Int32          ret  = self.GetClipCount();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static int QPYX_GetClipCount_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.Animation QPYX_obj_YXQP = (UnityEngine.Animation)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.Animation));
         int QPYX_o_YXQP = QPYX_obj_YXQP.GetClipCount();
         LuaDLL.lua_pushinteger(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int GetClipCount(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation));
         int o = obj.GetClipCount();
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 public static int GetClipCount_wrap(long L)
 {
     try
     {
         long nThisPtr             = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Animation obj = get_obj(nThisPtr);
         int  ret     = obj.GetClipCount();
         long ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         FCLibHelper.fc_set_value_int(ret_ptr, ret);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
Esempio n. 10
0
    void Awake()
    {

        // Setting up references.
        groundCheck = transform.Find("groundCheck");
        anim = GetComponent<Animation>();
        respawnPoint = transform.position;

        animations = new string[anim.GetClipCount()];
        int i = 0;
        foreach (AnimationState a in anim)
        {
            animations[i] = a.name;
            i++;
        }
    }
Esempio n. 11
0
    public override void OnInspectorGUI()
    {
        m_Object	= target as AnimationUnityEvent;
        m_Animation	= m_Object.GetComponent<Animation> ();
        m_ClipCount	= m_Animation.GetClipCount ();
        m_ClipNames	= new string[m_ClipCount];
        int i=0;
        foreach (AnimationState state in m_Animation) {
            m_ClipNames[i++]	= state.name;
        }

        serializedObject.Update ();
        base.OnInspectorGUI ();
        showAnimationsPopup ();
        showPropaties ();
        serializedObject.ApplyModifiedProperties ();
    }
Esempio n. 12
0
    static int GetClipCount(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Animation.GetClipCount");
#endif
        try
        {
            ToLua.CheckArgsCount(L, 1);
            UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation));
            int o = obj.GetClipCount();
            LuaDLL.lua_pushinteger(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 13
0
	public static AnimationClip SetAnimation(Animation tarAnimation, int tarIndex, AnimationClip srcClip)
	{
		int nCount = 0;
		AnimationClip[]	backClip = new AnimationClip[tarAnimation.GetClipCount() - tarIndex + 1];

		foreach (AnimationState clip in tarAnimation)
		{
			if (tarIndex == nCount)
				tarAnimation.RemoveClip(clip.clip);
			if (tarIndex < nCount)
			{
				backClip[nCount - tarIndex - 1] = clip.clip;
				tarAnimation.RemoveClip(clip.clip);
			}
		}

		tarAnimation.AddClip(srcClip, srcClip.name);
		for (int n = 0; n < backClip.Length; n++)
			tarAnimation.AddClip(backClip[n], backClip[n].name);
		return srcClip;
	}
        private void GenerateSetting(GameObject gameObject)
        {
            GameObject instanceObj = Instantiate(gameObject);

            UnityEngine.Animation animation = instanceObj.GetComponentInChildren <UnityEngine.Animation>();
            if (!animation)
            {
                return;
            }
            int index         = 0;
            int animclipCount = animation.GetClipCount();

            AnimationClip[] animationClips     = new AnimationClip[animclipCount];
            string[]        animationClipNames = new string[animclipCount];
            foreach (AnimationState animationState in animation)
            {
                animationClips[index]     = animationState.clip;
                animationClipNames[index] = animationState.clip.name;
                index++;
            }
            DestroyImmediate(instanceObj);
            exportParams.AnimationClips = animationClips;
            exportParams.AnimationNames = animationClipNames;
        }
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animation>();
     Debug.Log (anim.GetClipCount());
 }