本文整理匯總了C#中UnityEngine.Animator.GetNextAnimatorStateInfo方法的典型用法代碼示例。如果您正苦於以下問題:C# Animator.GetNextAnimatorStateInfo方法的具體用法?C# Animator.GetNextAnimatorStateInfo怎麽用?C# Animator.GetNextAnimatorStateInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEngine.Animator
的用法示例。
在下文中一共展示了Animator.GetNextAnimatorStateInfo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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.
}
}
示例2: 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);
}
}
示例3: 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);
}
}