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


C# Animator.GetAnimatorTransitionInfo方法代码示例

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


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

示例1: OnStateMove

        public override void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            var normTime = animator.GetAnimatorTransitionInfo(layerIndex).normalizedTime;
            var go = animator.gameObject;
            if (normTime > 0 && canSetVolume /*&& normTime < 1*/)
            {
                int count = Parameters.ParameterList.Count;
                if (!canSetVolume)
                {
                    
                }
                canSetVolume = true;

                for (int i = 0; i < count; i++)
                {
                    var elem = Parameters.ParameterList[i];
                    //if (elem.StartVolume != elem.Target)
                    {
                        float lerp = Mathf.Lerp(elem.StartVolume, elem.Target, normTime);
                        //Debug.Log(name + " " + lerp + " " + elem.StartVolume + " " + elem.Target);
                        InAudio.SetVolumeForNode(go, elem.Node, lerp);
                    }
                }
            }
            //Debug.Log(animator.GetAnimatorTransitionInfo(layerIndex).normalizedTime);
            
        }
开发者ID:mhfirdausi,项目名称:VGDSix,代码行数:27,代码来源:InAudioMecanimStateNode.cs

示例2: UpdateStateProgress

    // Updates the progress counter of this animation state.
    void UpdateStateProgress (Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
        AnimatorTransitionInfo info = animator.GetAnimatorTransitionInfo (layerIndex);

        if (animator.GetNextAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()) { //Entering the state
            m_progress = info.normalizedTime; // Set progress of the animation to the time taken so far.
        } else if(animator.GetCurrentAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()){ //Exiting the state
            m_progress = (1 - info.normalizedTime); // Set the final progress of the animation.
        }

    }
开发者ID:kamilion,项目名称:UNETMovement,代码行数:11,代码来源:NetworkedObserverSMMouseLook.cs

示例3: UpdateStatePower

	void UpdateStatePower(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){
		AnimatorTransitionInfo info = animator.GetAnimatorTransitionInfo (layerIndex);

		if (animator.GetNextAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()) { //Entering the state
			_power = info.normalizedTime;
		}else if(animator.GetCurrentAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()){ //Exiting the state
			_power = (1-info.normalizedTime);
		}

	}
开发者ID:omgware,项目名称:UnityUnetMovement,代码行数:10,代码来源:MouseLook.cs

示例4: OnStateUpdate

	 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
	//override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}

	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
		AnimatorTransitionInfo info = animator.GetAnimatorTransitionInfo (layerIndex);
		if (animator.GetNextAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()) { //Entering the state
			_power = info.normalizedTime;
		}else if(animator.GetCurrentAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()){ //Exiting the state
			_power = (1-info.normalizedTime);
		}
		if (_power > 0.98f) {
			animator.SetBool ("Holstered", true);
			animator.SetBool ("Holster", false);
		}
	}
开发者ID:omgware,项目名称:UnityUnetMovement,代码行数:18,代码来源:Holster.cs

示例5: OnStateEnter

    // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Log(1 + "-" + stateInfo.fullPathHash + "-" + Animator.StringToHash("Base.Idle.idle1")+"-"+ stateInfo.length + "-" + stateInfo.normalizedTime + "-" + (stateInfo.normalizedTime - prev));
        prev = stateInfo.normalizedTime;

        //  animationManager.initState(animator, stateInfo);
        AnimationEvent ae = new AnimationEvent();
        ae.functionName = "animationEvent";

        AnimatorTransitionInfo ati = animator.GetAnimatorTransitionInfo(layerIndex);

        AnimatorClipInfo aci = animator.GetCurrentAnimatorClipInfo(layerIndex)[0];
        aci.clip.AddEvent(ae);
        Debug.Log( "进入:"+ aci.clip.name +"-"+ stateInfo.fullPathHash + "-" + stateInfo.length + "-" + stateInfo.normalizedTime + "-" + (stateInfo.normalizedTime - prev));
        //animator.SetInteger("idle",Random.Range(1, 3));
        //AnimationAction animationAction = AnimationManager.getAnimationAction(animator);
    }
开发者ID:exolution,项目名称:cosmic-editor,代码行数:18,代码来源:AnimationBehaviour.cs

示例6: OnStateUpdate

    // OnStateUpdate is called before OnStateUpdate is called on any state inside this state machine
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Break();
        AnimatorTransitionInfo ati = animator.GetAnimatorTransitionInfo(layerIndex);

        AnimatorClipInfo []acis = animator.GetCurrentAnimatorClipInfo(layerIndex);
        string acit = "";
        foreach (AnimatorClipInfo aci in acis){
            acit += "["+aci.weight + ":" + aci.clip.name+"],";
        }
        //Debug.Log(2 + "-[" + ati.normalizedTime + "]-["+animator.GetCurrentAnimatorClipInfo(layerIndex)[0].clip.name+ "]-["+stateInfo.normalizedTime+"]-"+ (stateInfo.normalizedTime-prev));
        prev = stateInfo.normalizedTime;
        Debug.Log("update:" + stateInfo.fullPathHash+"-"+acit+stateInfo.normalizedTime);
        if (stateInfo.normalizedTime>0.8f)
        {
           // Debug.Log(stateInfo.fullPathHash);
            //animator.SetInteger("Attack", 0);
           //Debug.Break();
        }
    }
开发者ID:exolution,项目名称:cosmic-editor,代码行数:21,代码来源:AnimationBehaviour.cs

示例7: Start

 void Start()
 {
     controller = GetComponent<CharacterController>();
     cam = Camera.main;
     anim = GetComponentInChildren<Animator>();
     armsTransitionInfo = anim.GetAnimatorTransitionInfo(1);
     EquipGun(0);
 }
开发者ID:LazyGod,项目名称:1999,代码行数:8,代码来源:PlayerController.cs

示例8: CheckForAnimatorStateChanges

		public void CheckForAnimatorStateChanges (Animator animator) {
			for (int layer = 0; layer < LayerCount; layer++) {
				LayerStatuses [layer].State.Current = animator.GetCurrentAnimatorStateInfo (layer).nameHash;
				if (animator.IsInTransition (layer)) {
					LayerStatuses [layer].Transition.Current = animator.GetAnimatorTransitionInfo (layer).nameHash;
				} else {
					LayerStatuses [layer].Transition.Current = 0;
				}
			}
			if (StateHandlers != null && StateHandlers.Count > 0) {
                var enumerator = StateHandlers.GetEnumerator();
                try {
                    while (enumerator.MoveNext()) {

                        var pair = enumerator.Current;
                        var handler = pair.Value;
                        handler.Perform (LayerStatuses, StateInfos);
                    }
                }
                finally {
                    enumerator.Dispose();
                }

			}
			if (TransitionHandlers != null && TransitionHandlers.Count > 0) {
                var enumerator = TransitionHandlers.GetEnumerator();
                try {
                    while (enumerator.MoveNext()) {

                        var pair = enumerator.Current;
                        var handler = pair.Value;
                        handler.Perform (LayerStatuses, TransitionInfos);
                    }
                }
                finally {
                    enumerator.Dispose();
                }
			}
		}
开发者ID:Avatarchik,项目名称:AnimatorAccess,代码行数:39,代码来源:EventManager.cs


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