当前位置: 首页>>代码示例>>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;未经允许,请勿转载。