コード例 #1
0
        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);
        }