當前位置: 首頁>>代碼示例>>C#>>正文


C# Animation.RemoveClip方法代碼示例

本文整理匯總了C#中UnityEngine.Animation.RemoveClip方法的典型用法代碼示例。如果您正苦於以下問題:C# Animation.RemoveClip方法的具體用法?C# Animation.RemoveClip怎麽用?C# Animation.RemoveClip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.Animation的用法示例。


在下文中一共展示了Animation.RemoveClip方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetAnimation

	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;
	}
開發者ID:Kinderril,項目名稱:p3,代碼行數:21,代碼來源:NgAnimation.cs

示例2: CleanUnusedClips

        /**
         * <summary>Cleans the supplied Animation component of any clips not being played.</summary>
         * <param name = "_animation">The Animation component to clean</param>
         */
        public static void CleanUnusedClips(Animation _animation)
        {
            // Remove any non-playing animations
            List <string> removeClips = new List <string>();

            foreach (AnimationState state in _animation)
            {
                if (!_animation [state.name].enabled)
                {
                    // Queued animations get " - Queued Clone" appended to it, so remove

                    int queueIndex = state.name.IndexOf (" - Queued Clone");

                    if (queueIndex > 0)
                    {
                        removeClips.Add (state.name.Substring (0, queueIndex));
                    }
                    else
                    {
                        removeClips.Add (state.name);
                    }
                }
            }

            foreach (string _clip in removeClips)
            {
                _animation.RemoveClip (_clip);
            }
        }
開發者ID:mcbodge,項目名稱:eidolon,代碼行數:33,代碼來源:AdvGame.cs

示例3: Initialize

 protected void Initialize(Animation animation, Transform transform, string newName = null)
 {
     if (clip == null)
     {
         Debug.LogError ("clip is null. Cannot initialize animation " + (name == null ? "NULL" : name));
         return;
     }
     animation.RemoveClip (Name);
     if (newName != null)
         name = newName;
     animation.AddClip (clip, Name);
     animation [Name].layer = Layer;
     foreach(var mt in MixingTransforms)
     {
         if (AnimationNames.ContainsKey(mt) && transform.Find (AnimationNames [mt]) != null && transform != null)
             animation [Name].AddMixingTransform (transform.Find (AnimationNames [mt]));
         else
             Debug.LogError ("[assembly: " + Assembly.GetExecutingAssembly ().GetName().Name + "]: animation mixing transform " + mt + " from animation " + Name + " does not exist, or could not be found.");
     }
 }
開發者ID:Kerbas-ad-astra,項目名稱:KerbalAnimationSuite,代碼行數:20,代碼來源:KerbalAnimationClip.cs

示例4: metcrossfadetransitionanimation

 public static int metcrossfadetransitionanimation(Transform varpcharacter, string varpdestinationanimname, float varptransitiontime, Transform varpcontroller = null, string varpstateanimationname = "", bool varpgokinematic = true, string varpnewanimname = "transition", Animation varpanimationsystem = null, SkinnedMeshRenderer varprenderer = null, clsurganimationstatesmanager varpstatesmanager = null)
 {
     if (varpcharacter == null)
     {
         return -1;
     }
     if (varptransitiontime == 0f)
     {
         return -2;
     }
     if (varpanimationsystem == null)
     {
         varpanimationsystem = varpcharacter.root.GetComponentInChildren<Animation>();
         if (varpanimationsystem == null)
         {
             return -3;
         }
         varpanimationsystem.Stop();
     }
     if (varprenderer == null)
     {
         varprenderer = varpcharacter.root.GetComponentInChildren<SkinnedMeshRenderer>();
         if (varprenderer == null)
         {
             return -4;
         }
     }
     if (varpgokinematic)
     {
         clsurgutils.metgodriven(varpcharacter, true);
     }
     Vector3 localPosition = default(Vector3);
     if (varpcontroller != null)
     {
         Vector3 position = varpcharacter.position;
         varpcontroller.position = position;
         varpcharacter.localPosition = localPosition;
     }
     AnimationClip animationClip = clsurgutils.metcreatetransitionanimation(varpcharacter, varpdestinationanimname, varptransitiontime, varpnewanimname, ref localPosition, varpstatesmanager, false);
     if (animationClip != null)
     {
         varpanimationsystem.Stop();
         AnimationState animationState = varpanimationsystem[varpdestinationanimname];
         if (animationState != null && animationState.name != varpdestinationanimname)
         {
             varpanimationsystem.RemoveClip(varpnewanimname);
         }
         varpanimationsystem.AddClip(animationClip, varpnewanimname);
         if (varpstateanimationname != string.Empty)
         {
             varpanimationsystem[varpnewanimname].wrapMode = WrapMode.Once;
             varpanimationsystem.CrossFade(varpnewanimname);
             varpanimationsystem.CrossFadeQueued(varpstateanimationname);
         }
         else
         {
             varpanimationsystem.CrossFade(varpnewanimname);
         }
         return 1;
     }
     Debug.LogError("Could not create transition");
     return -5;
 }
開發者ID:GameDiffs,項目名稱:TheForest,代碼行數:63,代碼來源:clsurgutils.cs


注:本文中的UnityEngine.Animation.RemoveClip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。