Beispiel #1
0
        public void UpdatePhase2()
        {
            float highestWeight = 0f;

            for (int i = 0; i < m_eventLayers.Count; ++i)
            {
                EventLayerData eventLayer = m_eventLayers[i];

                float curTime = (float)eventLayer.ClipPlayable.GetTime();

                float age      = curTime - eventLayer.StartTime;
                float deathAge = eventLayer.EndTime - curTime;

                float weight = Mathf.Min(Mathf.Clamp01(age / eventLayer.BlendRate), Mathf.Clamp01(deathAge / eventLayer.BlendRate));

                if (weight > highestWeight)
                {
                    highestWeight = weight;
                }

                if (curTime >= eventLayer.EndTime)
                {
                    m_layerMixer.SetInputWeight(eventLayer.SlotId, 0f);
                    m_layerMixer.DisconnectInput(eventLayer.SlotId);
                    eventLayer.ClipPlayable.Destroy();
                    m_eventLayers.RemoveAt(i);
                    --i;
                }
                else if (Mathf.Abs(weight - eventLayer.Weight) > Mathf.Epsilon)
                {
                    eventLayer.Weight = weight;
                    m_eventLayers[i]  = eventLayer;
                    m_layerMixer.SetInputWeight(eventLayer.SlotId, weight);
                }
            }

            if (m_eventLayers.Count > 0)
            {
                m_mxmAnimator.SetLayerWeight(m_layerId, highestWeight);
            }
        }
Beispiel #2
0
 public virtual void Destroy(AnimationLayerMixerPlayable AnimationLayerMixerPlayable)
 {
     AnimationLayerMixerPlayable.DisconnectInput(this.Inputhandler);
 }