當前位置: 首頁>>代碼示例>>C#>>正文


C# Animator.GetLayerWeight方法代碼示例

本文整理匯總了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);
                }
            }
        }
開發者ID:farreltr,項目名稱:OneLastSunset,代碼行數:32,代碼來源:SequencerCommandAnimatorLayer.cs


注:本文中的UnityEngine.Animator.GetLayerWeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。