当前位置: 首页>>代码示例>>C#>>正文


C# Animation.AddClip方法代码示例

本文整理汇总了C#中UnityEngine.Animation.AddClip方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.AddClip方法的具体用法?C# Animation.AddClip怎么用?C# Animation.AddClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Animation的用法示例。


在下文中一共展示了Animation.AddClip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitAnimations

 private void InitAnimations()
 {
     animation = GetComponentInChildren<Animation> ();
     animation.AddClip (walk, "Walk");
     animation.AddClip (aim, "Aim");
     animation.AddClip (kick, "Kick");
     animation ["Walk"].layer = 0;
     animation ["Aim"].layer = 1;
     animation ["Aim"].AddMixingTransform (transform.Find ("player/Armature/root/stomach/upper_arm_L"));
     animation ["Aim"].AddMixingTransform (transform.Find ("player/Armature/root/stomach/upper_arm_R"));
     animation ["Kick"].AddMixingTransform (transform.Find ("player/Armature/root/stomach/upper_leg_R"));
     animation.wrapMode = WrapMode.Loop;
 }
开发者ID:WaDelma,项目名称:PseudoRandom,代码行数:13,代码来源:PlayerController.cs

示例2: Start

    private float idleSwitchDelay; // A random time to play RandomIdle animation

    void Start () {
        monster = GetComponent<Monster>();
        
        animation = monster.monsterGameObject.GetComponent<Animation>();

        // Initialize monster animator
        if(animationClips.idle != null)
            animation.AddClip(animationClips.idle, "Idle");

        if(animationClips.randomIdle != null) {
            animation.AddClip(animationClips.randomIdle, "RandomIdle");

            idleSwitchDelay = (Length("Idle") * UnityEngine.Random.Range(4, 8)) + Time.time;
        }

        if(animationClips.moveForward != null)
            animation.AddClip(animationClips.moveForward, "MoveForward");
        if(animationClips.moveBackward != null)
            animation.AddClip(animationClips.moveBackward, "MoveBackward");
        if(animationClips.physicalAttack != null)
            animation.AddClip(animationClips.physicalAttack, "PhysicalAttack");
        if(animationClips.specialAttack != null)
            animation.AddClip(animationClips.specialAttack, "SpecialAttack");
        if(animationClips.takeDamage != null)
            animation.AddClip(animationClips.takeDamage, "TakeDamage");
        if(animationClips.dead != null)
            animation.AddClip(animationClips.dead, "Dead");

        Play("Idle");
    }
开发者ID:Jian881219,项目名称:TurnBasedBattleKit,代码行数:32,代码来源:MonsterAnimator.cs

示例3: CreateEffect

 public override void CreateEffect()
 {
     base.CreateEffect();
     m_animation = GetComponent<Animation>();
     if( m_animation == null)
     {
         m_animation = this.gameObject.AddComponent<Animation>();
         if(ShowAnim != null)
             m_animation.AddClip(ShowAnim, "ShowAnim");
         if(HideAnim != null)
             m_animation.AddClip(HideAnim, "HideAnim");
         if(IdleAnim != null)
             m_animation.AddClip(IdleAnim, "IdelAnim");
     }
 }
开发者ID:zhenghehe2014,项目名称:u3dframework,代码行数:15,代码来源:ShowAnimUIEffect.cs

示例4: Start

 // Use this for initialization
 void Start()
 {
     animation = GetComponent<Animation>();
     animation.AddClip(animationClip, "animationClip");
     animation["animationClip"].speed = speed;
     animation.wrapMode = WrapMode.Loop;
 }
开发者ID:WaDelma,项目名称:PseudoRandom,代码行数:8,代码来源:SimpleAnimation.cs

示例5: TransferAnimation

    public void TransferAnimation(Animation target, Transform avatar)
    {
        Debug.LogWarning("here");
        target.AddClip(clip, clip.name);
        target[clip.name].layer = animationLayer;
        //StartCoroutine(MixingTransforms( addMixingTransforms, removeMixingTransforms, clip));
        //yield return null;

        if(addMixingTransforms.Count>0)
        {
            for (int i = 0; i < addMixingTransforms.Count; i++) {
                target[clip.name].AddMixingTransform(GetBone(addMixingTransforms[i], avatar), false);
                //yield return null;
            }
        }

        if(removeMixingTransforms.Count>0)
        {
            for (int i = 0; i < removeMixingTransforms.Count; i++)
            {
                target[clip.name].RemoveMixingTransform(GetBone(removeMixingTransforms[i], avatar));
                //yield return null;
            }
        }
    }
开发者ID:reaganq,项目名称:mixabots,代码行数:25,代码来源:ArmorAnimation.cs

示例6: 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

示例7: Create

    public void Create(Creature ac)
    {
        m_ac = ac;
        m_ac.OnDead += OnDead;
        m_ac.OnTakeDamage += OnTakeDamage;

        m_anim_ctl = ResMgr.Instance.CreateGameObject(string.Format("Creature/{0}/{1}", ac.Proto.Key, ac.Proto.Key), gameObject).GetComponent<Animation>();
        m_anim_ctl.AddClip(ResMgr.Instance.Load(string.Format("Creature/{0}/FIdle", ac.Proto.Key)) as AnimationClip, "FIdle");
        m_anim_ctl.AddClip(ResMgr.Instance.Load(string.Format("Creature/{0}/Fight", ac.Proto.Key)) as AnimationClip, "Fight");
        m_anim_ctl.AddClip(ResMgr.Instance.Load(string.Format("Creature/{0}/Die", ac.Proto.Key)) as AnimationClip, "Die");
        m_anim_ctl.AddClip(ResMgr.Instance.Load(string.Format("Creature/{0}/Walk", ac.Proto.Key)) as AnimationClip, "Walk");
        m_anim_ctl.AddClip(ResMgr.Instance.Load(string.Format("Creature/{0}/BeHit", ac.Proto.Key)) as AnimationClip, "BeHit");

        m_anim_ctl["BeHit"].layer = 2;

        m_prog_hp = ResMgr.Instance.CreateGameObject("UI/PlaneProgHP", Launcher.Instance.CanvasUI.gameObject);
        m_img_prog_hp = Util.FindGameObjectByName(m_prog_hp, "Fill").GetComponent<Image>();
        m_img_prog_hp.fillAmount = 1;

        Idle();
    }
开发者ID:drawpixel,项目名称:DHunter,代码行数:21,代码来源:CreatureView.cs

示例8: TransferAnimation

    public IEnumerator TransferAnimation(Animation target, ArmorAnimation anim, Avatar avatar)
    {
        target.AddClip(anim.clip, anim.clip.name);
        target[anim.clip.name].layer = anim.animationLayer;
		target[anim.clip.name].speed = anim.speed;
        //StartCoroutine(MixingTransforms( anim.addMixingTransforms, anim.removeMixingTransforms, anim.clip));
        yield return new WaitForEndOfFrame();

		if(!anim.useWholeBody)
		{
			if(anim.useArmLBones)
			{
				target[anim.clip.name].AddMixingTransform(avatar.clavicleL, false);
				target[anim.clip.name].AddMixingTransform(avatar.shoulderL, false);
				target[anim.clip.name].AddMixingTransform(avatar.shoulderGuardL, false);
				target[anim.clip.name].AddMixingTransform(avatar.elbowL, false);
				target[anim.clip.name].AddMixingTransform(avatar.forearmL, false);
				target[anim.clip.name].AddMixingTransform(avatar.handL, false);
			}
			
			if(anim.useArmRBones)
			{
				target[anim.clip.name].AddMixingTransform(avatar.clavicleR, false);
				target[anim.clip.name].AddMixingTransform(avatar.shoulderR, false);
				target[anim.clip.name].AddMixingTransform(avatar.shoulderGuardR, false);
				target[anim.clip.name].AddMixingTransform(avatar.elbowR, false);
				target[anim.clip.name].AddMixingTransform(avatar.forearmR, false);
				target[anim.clip.name].AddMixingTransform(avatar.handR, false);
			}
			
			if(anim.useVerticalBones)
			{
				target[anim.clip.name].AddMixingTransform(avatar.spine2, false);
				target[anim.clip.name].AddMixingTransform(avatar.neckHorizontal, false);
			}
		}
        /*if(anim.addMixingTransforms.Count>0)
        {
            for (int i = 0; i < anim.addMixingTransforms.Count; i++) {
                target[anim.clip.name].AddMixingTransform(GetBone(anim.addMixingTransforms[i], avatar), false);
            }
        }
        
        if(anim.removeMixingTransforms.Count>0)
        {
            for (int i = 0; i < anim.removeMixingTransforms.Count; i++) 
            {
                target[anim.clip.name].RemoveMixingTransform(GetBone(anim.removeMixingTransforms[i], avatar));
            }
        }*/
    }
开发者ID:reaganq,项目名称:MagnetBots_unity,代码行数:51,代码来源:PassiveArmorAnimationController.cs

示例9: TransferAnimation

    public IEnumerator TransferAnimation(Animation target, ArmorAnimation anim, Transform avatar)
    {
        target.AddClip(anim.clip, anim.clip.name);
        target[anim.clip.name].layer = anim.animationLayer;
        //StartCoroutine(MixingTransforms( anim.addMixingTransforms, anim.removeMixingTransforms, anim.clip));
        yield return null;

        if(anim.addMixingTransforms.Count>0)
        {
            for (int i = 0; i < anim.addMixingTransforms.Count; i++) {
                target[anim.clip.name].AddMixingTransform(GetBone(anim.addMixingTransforms[i], avatar), false);
            }
        }

        if(anim.removeMixingTransforms.Count>0)
        {
            for (int i = 0; i < anim.removeMixingTransforms.Count; i++)
            {
                target[anim.clip.name].RemoveMixingTransform(GetBone(anim.removeMixingTransforms[i], avatar));
            }
        }
    }
开发者ID:reaganq,项目名称:mixabots,代码行数:22,代码来源:PassiveArmorAnimationController.cs

示例10: 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

示例11: AddClipToAnimationComponent

 public static bool AddClipToAnimationComponent(Animation animation, AnimationClip newClip)
 {
     SetClipAsLegacy(newClip);
     animation.AddClip(newClip, newClip.name);
     return true;
 }
开发者ID:demelev,项目名称:projectHL,代码行数:6,代码来源:AnimationWindowUtility.cs

示例12: Start

 // Use this for initialization
 void Start()
 {
     anim = (Animation)GetComponent("Animation");
     anim.AddClip(clip,"main");
 }
开发者ID:cxdcxd,项目名称:simserver,代码行数:6,代码来源:car_controller.cs

示例13: CopyAnimation

    // ------------------------------------------------------------------ 
    // Desc: 
    // ------------------------------------------------------------------ 

    static bool CopyAnimation ( Animation _src, Animation _dest ) {
        foreach ( AnimationState state in _src ) {
            _dest.AddClip(_src[state.name].clip, state.name);
        }
        _dest.clip=_src.clip;
        _dest.playAutomatically = _src.playAutomatically;
        _dest.animatePhysics = _src.animatePhysics;
        _dest.animateOnlyIfVisible = _src.animateOnlyIfVisible;
        return true;
    }
开发者ID:exdev,项目名称:urban-survivors,代码行数:14,代码来源:CompHelper.cs

示例14: StarEffectAnim

    void StarEffectAnim(Animation anim, GameObject tmp)
    {
        //Debug.Break();
        anim.enabled = true;
        AnimationClip animclip = new AnimationClip();
        #if UNITY_5
                animclip.legacy = true;
        #endif
        AnimationCurve curveScalex = AnimationCurve.Linear(0, tmp.transform.localScale.x, 1, 3);
        //AnimationCurve curveScaley = AnimationCurve.Linear(0, tmp.transform.localScale.y, 1, 3);
        AnimationCurve curvex = AnimationCurve.Linear(0, tmp.transform.position.x, 1, 0);
        AnimationCurve curvey = AnimationCurve.Linear(0, tmp.transform.position.y, 1, 0);
        AnimationCurve curvez = AnimationCurve.Linear(0, tmp.transform.position.z, 1, tmp.transform.position.z);
        AnimationCurve curveColora = AnimationCurve.Linear(0, 1, 1, 0);

        animclip.SetCurve("", typeof(Transform), "m_LocalScale.x", curveScalex);
        animclip.SetCurve("", typeof(Transform), "m_LocalScale.y", curveScalex);
        animclip.SetCurve("", typeof(Transform), "localPosition.x", curvex);
        animclip.SetCurve("", typeof(Transform), "localPosition.y", curvey);
        animclip.SetCurve("", typeof(Transform), "localPosition.z", curvez);
        animclip.SetCurve(tmp.transform.GetChild(0).name, typeof(SpriteRenderer), "m_Color.a", curveColora);
        // animclip.SetCurve("", typeof(Animation), "m_Enabled", curvenable);
        anim.wrapMode = WrapMode.Once;
        anim.AddClip(animclip, "Startwin");
        anim.Play("Startwin");
    }
开发者ID:darknessomi,项目名称:Unity-Match3,代码行数:26,代码来源:EffectSpawner.cs

示例15: TransferAnimations

    public void TransferAnimations(Animation target, CharacterMotor newcontroller)
    {
        rootAnimationTarget = target;
        controller = newcontroller;

        if(PreAttackClip != null)
        {
            rootAnimationTarget.AddClip(PreAttackClip, PreAttackClip.name);
            rootAnimationTarget[PreAttackClip.name].layer = attackAnimationLayer;
            StartCoroutine(MixingTransforms( AttackAnimationMixingTransforms, AttackAnimationRemoveTransforms, PreAttackClip ));
        }

        if(AttackClip != null)
        {
            rootAnimationTarget.AddClip(AttackClip, AttackClip.name);
            rootAnimationTarget[AttackClip.name].layer = attackAnimationLayer;
            StartCoroutine(MixingTransforms( AttackAnimationMixingTransforms, AttackAnimationRemoveTransforms, AttackClip ));
        }

        if(PostAttackClip != null)
        {
            rootAnimationTarget.AddClip(PostAttackClip, PostAttackClip.name);
            rootAnimationTarget[PostAttackClip.name].layer = attackAnimationLayer;
            StartCoroutine(MixingTransforms( AttackAnimationMixingTransforms, AttackAnimationRemoveTransforms, PostAttackClip ));
        }

        if(RecoilClip != null)
        {
            rootAnimationTarget.AddClip(RecoilClip, RecoilClip.name);
            rootAnimationTarget[RecoilClip.name].layer = attackAnimationLayer;
            StartCoroutine(MixingTransforms( AttackAnimationMixingTransforms, AttackAnimationRemoveTransforms, RecoilClip ));
        }

        if(hasIdleAnimationOverride)
        {
        rootAnimationTarget.AddClip(IdleOverrideAnimationClip, IdleOverrideAnimationClip.name);
        rootAnimationTarget[IdleOverrideAnimationClip.name].layer = idleAnimationLayer;

        StartCoroutine(MixingTransforms( IdleAnimationMixingTransformNames, IdleAnimationRemoveTransformNames, IdleOverrideAnimationClip ));
        }

        if(hasRunningOverride)
        {
        rootAnimationTarget.AddClip(RunningOverrideAnimationClip, RunningOverrideAnimationClip.name);
        rootAnimationTarget[RunningOverrideAnimationClip.name].layer = idleAnimationLayer;

        StartCoroutine(MixingTransforms( RunningAnimationMixingTransforms, RunningAnimationRemoveTransforms, RunningOverrideAnimationClip ));
        }
    }
开发者ID:reaganq,项目名称:mixabots,代码行数:49,代码来源:ArmorController.cs


注:本文中的UnityEngine.Animation.AddClip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。