本文整理匯總了C#中UnityEngine.Animator.GetLayerWeight方法的典型用法代碼示例。如果您正苦於以下問題:C# Animator.GetLayerWeight方法的具體用法?C# Animator.GetLayerWeight怎麽用?C# Animator.GetLayerWeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEngine.Animator
的用法示例。
在下文中一共展示了Animator.GetLayerWeight方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Start
public void Start()
{
// Get the values of the parameters:
layerIndex = GetParameterAsInt(0, 1);
weight = GetParameterAsFloat(1, 1);
subject = GetSubject(2);
duration = GetParameterAsFloat(3, 0);
if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AnimatorLayer({1}, {2}, {3}, {4})", new System.Object[] { DialogueDebug.Prefix, layerIndex, weight, subject, duration }));
// Check the parameters:
if (subject == null) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): subject '{1}' wasn't found.", new System.Object[] { DialogueDebug.Prefix, GetParameter(2) }));
Stop();
} else {
animator = subject.GetComponentInChildren<Animator>();
if (animator == null) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): no Animator found on '{1}'.", new System.Object[] { DialogueDebug.Prefix, subject.name }));
Stop();
} else if ((layerIndex < 1) || (layerIndex >= animator.layerCount)) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): layer index {1} is invalid.", new System.Object[] { DialogueDebug.Prefix, layerIndex }));
Stop();
} else if (duration < SmoothMoveCutoff) {
Stop();
} else {
// Set up the lerp:
startTime = DialogueTime.time;
endTime = startTime + duration;
originalWeight = animator.GetLayerWeight(layerIndex);
}
}
}