Ejemplo n.º 1
0
 private void FindMixers(Playable parent, int port, Playable node)
 {
     if (PlayableExtensions.IsValid <Playable>(node))
     {
         Type playableType = node.GetPlayableType();
         if (playableType == typeof(AnimationMixerPlayable) || playableType == typeof(AnimationLayerMixerPlayable))
         {
             int inputCount = PlayableExtensions.GetInputCount <Playable>(node);
             for (int i = 0; i < inputCount; i++)
             {
                 this.FindMixers(node, i, PlayableExtensions.GetInput <Playable>(node, i));
             }
             AnimationOutputWeightProcessor.WeightInfo item = new AnimationOutputWeightProcessor.WeightInfo
             {
                 parentMixer = parent,
                 mixer       = node,
                 port        = port,
                 modulate    = (playableType == typeof(AnimationLayerMixerPlayable))
             };
             this.m_Mixers.Add(item);
         }
         else
         {
             int inputCount2 = PlayableExtensions.GetInputCount <Playable>(node);
             for (int j = 0; j < inputCount2; j++)
             {
                 this.FindMixers(parent, port, PlayableExtensions.GetInput <Playable>(node, j));
             }
         }
     }
 }
 public override void PrepareFrame(Playable playable, FrameData info)
 {
     if (!(this.director == null) && this.director.get_isActiveAndEnabled() && !(this.director.get_playableAsset() == null))
     {
         if (this.director.get_playableGraph().IsValid())
         {
             int rootPlayableCount = this.director.get_playableGraph().GetRootPlayableCount();
             for (int i = 0; i < rootPlayableCount; i++)
             {
                 Playable rootPlayable = this.director.get_playableGraph().GetRootPlayable(i);
                 if (PlayableExtensions.IsValid <Playable>(rootPlayable))
                 {
                     PlayableExtensions.SetSpeed <Playable>(rootPlayable, (double)info.get_effectiveSpeed());
                 }
             }
         }
         if (info.get_evaluationType() == null)
         {
             if (Application.get_isPlaying())
             {
                 this.director.Pause();
             }
             this.UpdateTime(playable);
             this.director.Evaluate();
         }
         else if (Application.get_isPlaying())
         {
             if (PlayableExtensions.GetTime <Playable>(playable) < this.director.get_time())
             {
                 this.UpdateTime(playable);
             }
             this.director.Play();
         }
     }
 }
 public override void PrepareFrame(Playable playable, FrameData info)
 {
     if (this.m_timeControl != null)
     {
         this.m_timeControl.SetTime(PlayableExtensions.GetTime <Playable>(playable));
     }
 }
Ejemplo n.º 4
0
    // Called when the state of the playable is set to Play
    public override void OnBehaviourPlay(Playable playable, FrameData info)
    {
        maxTime = (float)PlayableExtensions.GetDuration(playable);
        var trans = EntityMgr.GetComponentObject <Transform>(Owner);

        if (EntityMgr.HasComponent <JumpState>(Owner) && trans != null)
        {
            var jumpState = EntityMgr.GetComponentData <JumpState>(Owner);
            jumpCount = math.clamp(jumpState.JumpCount + 1, 1, GameConst.MaxJumpCount);
            startYPos = trans.localPosition.y;
            if (jumpState.JumpCount == 0)
            {
                jumpState.OriginYPos   = trans.localPosition.y;
                jumpState.AscentHeight = 4;
            }
            else if (jumpState.JumpCount == 1)
            {
                jumpState.AscentHeight = 2.6f;
            }
            else if (jumpState.JumpCount == 2)
            {
                //第三段跳只是前进
                jumpState.AscentHeight = 0;
            }
            else
            {
            }
            jumpState.JumpCount  = jumpCount;
            jumpState.JumpStatus = JumpState.State.StartJump;
            // Debug.Log("jumpState.JumpCount : "+jumpState.JumpCount);
            EntityMgr.SetComponentData <JumpState>(Owner, jumpState);
        }
        Debug.Log("start jump");
        // EntityMgr.SetComponentData<TimelineState>(Owner, new TimelineState{NewStatus=newState, InterruptStatus=interruptState});
    }
Ejemplo n.º 5
0
 private void Evaluate(Playable playable, FrameData frameData)
 {
     if (this.m_IntervalTree != null)
     {
         double time = PlayableExtensions.GetTime <Playable>(playable);
         this.m_ActiveBit = ((this.m_ActiveBit != 0) ? 0 : 1);
         this.m_CurrentListOfActiveClips.Clear();
         this.m_IntervalTree.IntersectsWith(DiscreteTime.GetNearestTick(time), this.m_ActiveBit, ref this.m_CurrentListOfActiveClips);
         for (int i = 0; i < this.m_ActiveClips.Count; i++)
         {
             RuntimeElement runtimeElement = this.m_ActiveClips[i];
             if (runtimeElement.intervalBit != this.m_ActiveBit)
             {
                 runtimeElement.enable = false;
             }
         }
         for (int j = 0; j < this.m_CurrentListOfActiveClips.Count; j++)
         {
             this.m_CurrentListOfActiveClips[j].EvaluateAt(time, frameData);
         }
         this.m_ActiveClips.Clear();
         this.m_ActiveClips.AddRange(this.m_CurrentListOfActiveClips);
         int count = this.m_EvaluateCallbacks.Count;
         for (int k = 0; k < count; k++)
         {
             this.m_EvaluateCallbacks[k].Evaluate();
         }
     }
 }
Ejemplo n.º 6
0
 private void Create(TimelineClip clip, Playable clipPlayable, Playable parentMixer)
 {
     this.m_Clip        = clip;
     this.m_Playable    = clipPlayable;
     this.m_ParentMixer = parentMixer;
     PlayableExtensions.SetPlayState <Playable>(clipPlayable, 0);
 }
Ejemplo n.º 7
0
        public override void EvaluateAt(double localTime, FrameData frameData)
        {
            this.enable = true;
            float num;

            if (this.clip.IsPreExtrapolatedTime(localTime))
            {
                num = this.clip.EvaluateMixIn((double)((float)this.clip.start));
            }
            else if (this.clip.IsPostExtrapolatedTime(localTime))
            {
                num = this.clip.EvaluateMixOut((double)((float)this.clip.end));
            }
            else
            {
                num = this.clip.EvaluateMixIn(localTime) * this.clip.EvaluateMixOut(localTime);
            }
            if (PlayableExtensions.IsValid <Playable>(this.mixer))
            {
                PlayableExtensions.SetInputWeight <Playable, Playable>(this.mixer, this.playable, num);
            }
            double time = this.clip.ToLocalTime(localTime);

            if (time.CompareTo(0.0) >= 0)
            {
                this.SetTime(time);
            }
            this.SetDuration(this.clip.extrapolatedDuration);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Waits for the given IPlayable to be done.
 /// </summary>
 static public IEnumerator WaitToComplete <U>(this U inPlayable) where U : struct, IPlayable
 {
     while (!PlayableExtensions.IsDone(inPlayable))
     {
         yield return(null);
     }
 }
Ejemplo n.º 9
0
        public TwoDBlendTree(int layerId, PlayableGraph PlayableGraph, AnimationLayerMixerPlayable parentAnimationLayerMixerPlayable,
                             TwoDAnimationInput TwoDAnimationInput) : base(layerId, parentAnimationLayerMixerPlayable)
        {
            this.TwoDAnimationInput                   = TwoDAnimationInput;
            this.TwoDBlendTreeAnimationClips          = TwoDAnimationInput.TwoDBlendTreeAnimationClipInputs.ConvertAll(i => new TwoDBlendTreeAnimationClip(i.AnimationClip, i.TreePosition, i.Speed));
            this.TwoDBlendTreeAnimationClipsPositions = this.TwoDBlendTreeAnimationClips.ConvertAll(c => c.TreePosition).ToArray();
            this.Weights = new float[this.TwoDBlendTreeAnimationClipsPositions.Length];

            //create a playable mixer
            this.AnimationMixerPlayable = AnimationMixerPlayable.Create(PlayableGraph);

            foreach (var TwoDBlendTreeAnimationClip in TwoDBlendTreeAnimationClips)
            {
                var animationClipPlayable = AnimationClipPlayable.Create(PlayableGraph, TwoDBlendTreeAnimationClip.AnimationClip);
                animationClipPlayable.SetApplyFootIK(false);
                animationClipPlayable.SetApplyPlayableIK(false);
                animationClipPlayable.SetSpeed(TwoDBlendTreeAnimationClip.Speed);
                TwoDBlendTreeAnimationClip.InputHandler = PlayableExtensions.AddInput(this.AnimationMixerPlayable, animationClipPlayable, 0);
                PlayableExtensions.Play(animationClipPlayable);
                TwoDBlendTreeAnimationClip.AnimationClipPlayable = animationClipPlayable;
            }

            this.Inputhandler = PlayableExtensions.AddInput(parentAnimationLayerMixerPlayable, this.AnimationMixerPlayable, 0);
            if (TwoDAnimationInput.AvatarMask != null)
            {
                parentAnimationLayerMixerPlayable.SetLayerMaskFromAvatarMask((uint)this.Inputhandler, TwoDAnimationInput.AvatarMask);
            }
        }
 public override void EvaluateAt(double localTime, FrameData frameData)
 {
     if (frameData.get_timeHeld())
     {
         this.enable = false;
     }
     else
     {
         bool flag = frameData.get_seekOccurred() || frameData.get_timeLooped() || frameData.get_evaluationType() == 0;
         if (localTime <= this.start + this.duration - this.m_FinishTail)
         {
             float num = this.clip.EvaluateMixIn(localTime) * this.clip.EvaluateMixOut(localTime);
             if (PlayableExtensions.IsValid <Playable>(this.mixer))
             {
                 PlayableExtensions.SetInputWeight <Playable, Playable>(this.mixer, this.playable, num);
             }
             if (!this.m_Started || flag)
             {
                 double num2 = this.clip.ToLocalTime(Math.Max(localTime, this.clip.start));
                 double num3 = Math.Max(this.clip.start - localTime, 0.0) * this.clip.timeScale;
                 double num4 = this.m_Clip.duration * this.clip.timeScale;
                 this.m_AudioClipPlayable.Seek(num2, num3, num4);
                 this.m_Started = true;
             }
         }
     }
 }
Ejemplo n.º 11
0
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            //IL_0018: Unknown result type (might be due to invalid IL or missing references)
            //IL_001e: Invalid comparison between Unknown and I4
            //IL_0020: Unknown result type (might be due to invalid IL or missing references)
            //IL_0026: Unknown result type (might be due to invalid IL or missing references)
            //IL_0051: Unknown result type (might be due to invalid IL or missing references)
            //IL_0056: Unknown result type (might be due to invalid IL or missing references)
            //IL_0057: Unknown result type (might be due to invalid IL or missing references)
            //IL_005f: Unknown result type (might be due to invalid IL or missing references)
            if (!m_eventInstance.isValid())
            {
                if (!StartInstance())
                {
                    return;
                }
            }
            else if ((int)info.get_evaluationType() == 1 && PlayableExtensions.GetPreviousTime <Playable>(playable) > PlayableExtensions.GetTime <Playable>(playable))
            {
                StopInstance();
                if (!StartInstance())
                {
                    return;
                }
            }
            RESULT val = m_eventInstance.setVolume(info.get_weight() * m_volume);

            if ((int)val != 0)
            {
                Log.Warning($"Failed to set event instance volume: {val}.", 112, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Audio\\AudioEventPlayableBehaviour.cs");
            }
        }
Ejemplo n.º 12
0
        public static float NormalizeMixer(Playable mixer)
        {
            float result;

            if (!PlayableExtensions.IsValid <Playable>(mixer))
            {
                result = 0f;
            }
            else
            {
                int   inputCount = PlayableExtensions.GetInputCount <Playable>(mixer);
                float num        = 0f;
                for (int i = 0; i < inputCount; i++)
                {
                    num += PlayableExtensions.GetInputWeight <Playable>(mixer, i);
                }
                if (num > Mathf.Epsilon && num < 1f)
                {
                    for (int j = 0; j < inputCount; j++)
                    {
                        PlayableExtensions.SetInputWeight <Playable>(mixer, j, PlayableExtensions.GetInputWeight <Playable>(mixer, j) / num);
                    }
                }
                result = Mathf.Clamp01(num);
            }
            return(result);
        }
 public override void ProcessFrame(Playable playable, FrameData info, object playerData)
 {
     //IL_000f: Unknown result type (might be due to invalid IL or missing references)
     //IL_0010: Unknown result type (might be due to invalid IL or missing references)
     //IL_0015: Unknown result type (might be due to invalid IL or missing references)
     //IL_0019: Unknown result type (might be due to invalid IL or missing references)
     //IL_006a: Unknown result type (might be due to invalid IL or missing references)
     //IL_00ac: Unknown result type (might be due to invalid IL or missing references)
     //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
     //IL_00ba: Unknown result type (might be due to invalid IL or missing references)
     //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
     //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
     //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
     //IL_013b: Unknown result type (might be due to invalid IL or missing references)
     if (!(null == m_characterObject))
     {
         PlayableGraph graph = PlayableExtensions.GetGraph <Playable>(playable);
         double        time  = PlayableExtensions.GetTime <Playable>(graph.GetRootPlayable(0));
         foreach (TimelineClip clip in m_clips)
         {
             double start = clip.get_start();
             if (time < start)
             {
                 if (clip.IsPreExtrapolatedTime(time))
                 {
                     CharacterObjectColorModifierPlayableAsset characterObjectColorModifierPlayableAsset = (CharacterObjectColorModifierPlayableAsset)clip.get_asset();
                     m_characterObject.SetColorModifier(characterObjectColorModifierPlayableAsset.startColor);
                     m_currentClip = characterObjectColorModifierPlayableAsset;
                     return;
                 }
             }
             else
             {
                 double end = clip.get_end();
                 if (time <= end)
                 {
                     CharacterObjectColorModifierPlayableAsset characterObjectColorModifierPlayableAsset2 = (CharacterObjectColorModifierPlayableAsset)clip.get_asset();
                     float num           = Mathf.InverseLerp((float)start, (float)end, (float)time);
                     Color colorModifier = Color.Lerp(characterObjectColorModifierPlayableAsset2.startColor, characterObjectColorModifierPlayableAsset2.endColor, num);
                     m_characterObject.SetColorModifier(colorModifier);
                     m_currentClip = characterObjectColorModifierPlayableAsset2;
                     return;
                 }
                 if (clip.IsPostExtrapolatedTime(time))
                 {
                     CharacterObjectColorModifierPlayableAsset characterObjectColorModifierPlayableAsset3 = (CharacterObjectColorModifierPlayableAsset)clip.get_asset();
                     m_characterObject.SetColorModifier(characterObjectColorModifierPlayableAsset3.endColor);
                     m_currentClip = characterObjectColorModifierPlayableAsset3;
                     return;
                 }
             }
         }
         if (null != m_currentClip)
         {
             m_characterObject.SetColorModifier(m_currentClip.endColor);
             m_currentClip = null;
         }
     }
 }
 public void LiveLink()
 {
     if (PlayableExtensions.IsValid <AnimationOffsetPlayable>(this.m_AnimationOffsetPlayable))
     {
         this.m_AnimationOffsetPlayable.SetPosition(this.position);
         this.m_AnimationOffsetPlayable.SetRotation(this.rotation);
     }
 }
        private void CreateActivationPlayable(GameObject root, PlayableGraph graph, List <Playable> outplayables)
        {
            ScriptPlayable <ActivationControlPlayable> scriptPlayable = ActivationControlPlayable.Create(graph, root, this.postPlayback);

            if (PlayableExtensions.IsValid <ScriptPlayable <ActivationControlPlayable> >(scriptPlayable))
            {
                outplayables.Add(scriptPlayable);
            }
        }
 public override void OnBehaviourPause(Playable playable, FrameData info)
 {
     if (!(this.gameObject == null))
     {
         if (info.get_evaluationType() == null || PlayableExtensions.GetGraph <Playable>(playable).IsPlaying())
         {
             this.gameObject.SetActive(false);
         }
     }
 }
 private void Create(TimelineClip clip, Playable clipPlayable, Playable parentMixer, double startDelay, double finishTail)
 {
     this.m_Clip              = clip;
     this.m_Playable          = clipPlayable;
     this.m_AudioClipPlayable = (AudioClipPlayable)clipPlayable;
     this.m_ParentMixer       = parentMixer;
     this.m_StartDelay        = startDelay;
     this.m_FinishTail        = finishTail;
     PlayableExtensions.SetPlayState <Playable>(clipPlayable, 0);
 }
Ejemplo n.º 18
0
 public void Evaluate()
 {
     for (int i = 0; i < this.m_Mixers.Count; i++)
     {
         AnimationOutputWeightProcessor.WeightInfo weightInfo = this.m_Mixers[i];
         float num = (!weightInfo.modulate) ? 1f : PlayableExtensions.GetInputWeight <Playable>(weightInfo.parentMixer, weightInfo.port);
         PlayableExtensions.SetInputWeight <Playable>(weightInfo.parentMixer, weightInfo.port, num * WeightUtility.NormalizeMixer(weightInfo.mixer));
     }
     PlayableOutputExtensions.SetWeight <AnimationPlayableOutput>(this.m_Output, WeightUtility.NormalizeMixer(this.m_LayerMixer));
 }
        private static Playable ConnectPlayablesToMixer(PlayableGraph graph, List <Playable> playables)
        {
            Playable playable = Playable.Create(graph, playables.Count);

            for (int num = 0; num != playables.Count; num++)
            {
                ControlPlayableAsset.ConnectMixerAndPlayable(graph, playable, playables[num], num);
            }
            PlayableExtensions.SetPropagateSetTime <Playable>(playable, true);
            return(playable);
        }
        private static Playable ConnectPlayablesToMixer(PlayableGraph graph, List <Playable> playables)
        {
            Playable val = Playable.Create(graph, playables.Count);

            for (int i = 0; i != playables.Count; i++)
            {
                ConnectMixerAndPlayable(graph, val, playables[i], i);
            }
            PlayableExtensions.SetPropagateSetTime <Playable>(val, true);
            return(val);
        }
 public override void PrepareFrame(Playable playable, FrameData info)
 {
     //IL_0009: Unknown result type (might be due to invalid IL or missing references)
     //IL_0010: Unknown result type (might be due to invalid IL or missing references)
     if (m_curve != null)
     {
         float num  = (float)PlayableExtensions.GetTime <Playable>(playable);
         float num2 = (float)PlayableExtensions.GetDuration <Playable>(playable);
         float num3 = num / num2;
         float num4 = m_curve.Evaluate(num3);
         CubeSRP.SetLightIntensityFactor((object)this, num4);
     }
 }
Ejemplo n.º 22
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            var playable = ScriptPlayable <NavMeshBehaviour> .Create(graph);

            var navMeshBehaviour = playable.GetBehaviour();
            var x = PlayableExtensions.GetDuration(playable);
            var a = start.Resolve(graph.GetResolver());
            var b = end.Resolve(graph.GetResolver());
            var l = lookTarget.Resolve(graph.GetResolver());

            navMeshBehaviour.Init(a, b, l, (float)clipDuration);
            navMeshBehaviour.offset = offset;
            return(playable);
        }
Ejemplo n.º 23
0
        public BlendedAnimationLayer(PlayableGraph PlayableGraph, AnimationLayerMixerPlayable parentAnimationLayerMixerPlayable,
                                     int layerId, List <BlendedAnimationClip> blendedAnimationClips, BlendedAnimationSpeedCurve BlendedAnimationSpeedCurve) : base(layerId, parentAnimationLayerMixerPlayable)
        {
            BlendedAnimationClips           = blendedAnimationClips;
            this.BlendedAnimationSpeedCurve = BlendedAnimationSpeedCurve;
            //create a playable mixer
            this.AnimationMixerPlayable = AnimationMixerPlayable.Create(PlayableGraph);

            foreach (var blendedAnimationClip in blendedAnimationClips)
            {
                var animationClipPlayable = AnimationClipPlayable.Create(PlayableGraph, blendedAnimationClip.AnimationClip);
                animationClipPlayable.SetApplyFootIK(false);
                animationClipPlayable.SetApplyPlayableIK(false);
                blendedAnimationClip.InputHandler = PlayableExtensions.AddInput(this.AnimationMixerPlayable, animationClipPlayable, 0);
                PlayableExtensions.Play(animationClipPlayable);
                blendedAnimationClip.AnimationClipPlayable = animationClipPlayable;
            }

            //calculate blendings
            for (var i = 0; i < blendedAnimationClips.Count; i++)
            {
                if (i == 0)
                {
                    blendedAnimationClips[i].Blending = blendedAnimationClips[i].Blending.SetWeightTimePoints(
                        AnimationWeightStartIncreasingTime: 0f,
                        AnimationWeightEndIncreasingTime: blendedAnimationClips[i].WeightTime,
                        AnimationWeightStartDecreasingTime: blendedAnimationClips[i].WeightTime,
                        AnimationWeightEndDecreasingTime: blendedAnimationClips[i + 1].WeightTime
                        );
                }
                else if (i == blendedAnimationClips.Count - 1)
                {
                    blendedAnimationClips[i].Blending = blendedAnimationClips[i].Blending.SetWeightTimePoints(
                        AnimationWeightStartIncreasingTime: blendedAnimationClips[i - 1].WeightTime,
                        AnimationWeightEndIncreasingTime: blendedAnimationClips[i].WeightTime,
                        AnimationWeightStartDecreasingTime: blendedAnimationClips[i].WeightTime,
                        AnimationWeightEndDecreasingTime: 1f
                        );
                }
                else
                {
                    blendedAnimationClips[i].Blending = blendedAnimationClips[i].Blending.SetWeightTimePoints(
                        AnimationWeightStartIncreasingTime: blendedAnimationClips[i - 1].WeightTime,
                        AnimationWeightEndIncreasingTime: blendedAnimationClips[i].WeightTime,
                        AnimationWeightStartDecreasingTime: blendedAnimationClips[i].WeightTime,
                        AnimationWeightEndDecreasingTime: blendedAnimationClips[i + 1].WeightTime
                        );
                }
            }
        }
Ejemplo n.º 24
0
        private static void SetAnimationMixerPlayableWeight(AnimationMixerPlayable AnimationMixerPlayable, AnimationClipPlayable AnimationClipPlayable, int inputHandler, float weight)
        {
            if (PlayableExtensions.GetInputWeight(AnimationMixerPlayable, inputHandler) == 0f && weight > 0f)
            {
                AnimationClipPlayable.SetTime(0f);
                AnimationClipPlayable.Play();
            }
            else if (weight == 0f)
            {
                AnimationClipPlayable.Pause();
            }

            PlayableExtensions.SetInputWeight(AnimationMixerPlayable, inputHandler, weight);
        }
Ejemplo n.º 25
0
        private Playable CreateTrackPlayable(PlayableGraph graph, Playable timelinePlayable, TrackAsset track, GameObject go, bool createOutputs)
        {
            Playable result;

            TimelinePlayable.ConnectionCache connectionCache;
            if (!track.compilable)
            {
                result = timelinePlayable;
            }
            else if (this.m_PlayableCache.TryGetValue(track, out connectionCache))
            {
                result = connectionCache.playable;
            }
            else if (track.get_name() == "root")
            {
                result = timelinePlayable;
            }
            else
            {
                TrackAsset trackAsset = track.parent as TrackAsset;
                Playable   playable   = (!(trackAsset != null)) ? timelinePlayable : this.CreateTrackPlayable(graph, timelinePlayable, trackAsset, go, createOutputs);
                Playable   playable2  = TimelinePlayable.CreatePlayableGraph(graph, track, go, this.m_IntervalTree);
                bool       flag       = false;
                if (!PlayableExtensions.IsValid <Playable>(playable2))
                {
                    throw new InvalidOperationException(string.Concat(new object[]
                    {
                        track.get_name(),
                        "(",
                        track.GetType(),
                        ") did not produce a valid playable. Use the compilable property to indicate whether the track is valid for processing"
                    }));
                }
                if (PlayableExtensions.IsValid <Playable>(playable) && PlayableExtensions.IsValid <Playable>(playable2))
                {
                    int inputCount = PlayableExtensions.GetInputCount <Playable>(playable);
                    PlayableExtensions.SetInputCount <Playable>(playable, inputCount + 1);
                    flag = graph.Connect <Playable, Playable>(playable2, 0, playable, inputCount);
                    PlayableExtensions.SetInputWeight <Playable>(playable, inputCount, 1f);
                }
                if (createOutputs && flag)
                {
                    this.CreateTrackOutput(graph, track, playable, PlayableExtensions.GetInputCount <Playable>(playable) - 1);
                }
                this.CacheTrack(track, playable2, (!flag) ? -1 : (PlayableExtensions.GetInputCount <Playable>(playable) - 1), playable);
                result = playable2;
            }
            return(result);
        }
Ejemplo n.º 26
0
 public sealed override void PrepareFrame(Playable playable, FrameData info)
 {
     if (this.m_HasFired)
     {
         if (this.HasLooped(PlayableExtensions.GetTime <Playable>(playable), info) || this.CanRestoreEvent(PlayableExtensions.GetTime <Playable>(playable), info))
         {
             this.Restore_internal();
         }
     }
     if (!this.m_HasFired && this.CanTriggerEvent(PlayableExtensions.GetTime <Playable>(playable), info))
     {
         this.Trigger_internal();
     }
     this.m_PreviousTime = PlayableExtensions.GetTime <Playable>(playable);
 }
Ejemplo n.º 27
0
        private void PlayTwoDBlendedAnimation(int layerID, TwoDAnimationInput TwoDAnimationInput)
        {
            if (this.AllAnimationLayersCurrentlyPlaying.ContainsKey(layerID))
            {
                this.DestroyLayer(layerID);
            }

            TwoDBlendTree TwoDBlendTree = new TwoDBlendTree(layerID, this.GlobalPlayableGraph, this.AnimationLayerMixerPlayable, TwoDAnimationInput);

            this.AllAnimationLayersCurrentlyPlaying[layerID] = TwoDBlendTree;
            this.OrderedByInputHandlerAnimationLayers.Add(TwoDBlendTree);

            this.SortLayers();

            PlayableExtensions.SetInputWeight(this.AnimationLayerMixerPlayable, this.AllAnimationLayersCurrentlyPlaying[layerID].Inputhandler, 1f);
        }
Ejemplo n.º 28
0
        private void PlaySequencedAnimation(int layerID, SequencedAnimationInput SequencedAnimationInput, Action OnAnimationEnd)
        {
            if (this.AllAnimationLayersCurrentlyPlaying.ContainsKey(layerID))
            {
                this.DestroyLayer(layerID);
            }

            var SequencedAnimationLayer = new SequencedAnimationLayer(this.GlobalPlayableGraph, this.AnimationLayerMixerPlayable, layerID, SequencedAnimationInput, OnAnimationEnd);

            this.AllAnimationLayersCurrentlyPlaying[layerID] = SequencedAnimationLayer;
            this.OrderedByInputHandlerAnimationLayers.Add(SequencedAnimationLayer);

            this.SortLayers();

            PlayableExtensions.SetInputWeight(this.AnimationLayerMixerPlayable, SequencedAnimationLayer.Inputhandler, 1f);
        }
Ejemplo n.º 29
0
        private void PlayBlendedAnimation(int layerID, BlendedAnimationInput BlendedAnimationInput, Func <float> InputWeightProvider)
        {
            if (this.AllAnimationLayersCurrentlyPlaying.ContainsKey(layerID))
            {
                this.DestroyLayer(layerID);
            }

            BlendedAnimationLayer BlendedAnimationLayer = new BlendedAnimationLayer(this.GlobalPlayableGraph, this.AnimationLayerMixerPlayable, layerID,
                                                                                    BlendedAnimationInput, InputWeightProvider);

            this.AllAnimationLayersCurrentlyPlaying[layerID] = BlendedAnimationLayer;
            this.OrderedByInputHandlerAnimationLayers.Add(BlendedAnimationLayer);

            this.SortLayers();

            PlayableExtensions.SetInputWeight(this.AnimationLayerMixerPlayable, this.AllAnimationLayersCurrentlyPlaying[layerID].Inputhandler, 1f);
        }
Ejemplo n.º 30
0
 public override void ProcessFrame(Playable playable, FrameData info, object playerData)
 {
     if (!(this.boundGameObject == null))
     {
         int  inputCount = PlayableExtensions.GetInputCount <Playable>(playable);
         bool active     = false;
         for (int i = 0; i < inputCount; i++)
         {
             if (PlayableExtensions.GetInputWeight <Playable>(playable, i) > 0f)
             {
                 active = true;
                 break;
             }
         }
         this.boundGameObject.SetActive(active);
     }
 }