public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
            {
                ScriptPlayable <MaterialColorParamTrackMixer> playable = TimelineUtils.CreateTrackMixer <MaterialColorParamTrackMixer>(this, graph, go, inputCount);

                ParentBindableTrack.OnCreateTrackMixer(this, playable.GetBehaviour(), graph);

                return(playable);
            }
    // private FacialExpressionTimeline binding;
    // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        blendShapeMesh = playerData as SkinnedMeshRenderer;

        if (!blendShapeMesh)
        {
            return;
        }

        // int inputCount = playable.GetInputCount ();

        for (int i = 0; i < Clips.Length; i++)
        {
            var   clip        = Clips[i];
            float inputWeight = playable.GetInputWeight(i);
            ScriptPlayable <AutoEyeBlinkerBehaviour> inputPlayable = (ScriptPlayable <AutoEyeBlinkerBehaviour>)playable.GetInput(i);
            AutoEyeBlinkerBehaviour input = inputPlayable.GetBehaviour();



            if (clip.start <= Director.time && Director.time <= clip.end)
            {
                var startTime = clip.start + input.nextStartTime;
                var endTime   = startTime + input.blinkDuration;
                if (Director.time > endTime)
                {
                    input.nextStartTime = Mathf.Clamp(input.nextStartTime + Random.Range(input.randomOpenDurationMin, input.randomOpenDurationMax), 0f, (float)clip.duration - input.blinkDuration);
                    // if(input.nextStartTime > clip.end - input.blinkDuration)
                }
                var clipProgress = Mathf.Clamp(((float)(Director.time - startTime) / input.blinkDuration), 0f, 1f);

                input.progress = clipProgress;

                if (Director.time > endTime && input.progress < 1f)
                {
                    input.progress = 1f;
                }

                UpdateFacial(input.preset, input.easing.Evaluate(input.progress));
                Debug.Log($"time: {Director.time}, next: {startTime},progress: {clipProgress}, end:{endTime}");
            }

            if (clip.end < Director.time && input.progress != 1)
            {
                input.progress = 1f;
                UpdateFacial(input.preset, input.easing.Evaluate(input.progress));
            }
            if (Director.time < clip.start)
            {
                input.nextStartTime = 0f;
                if (input.progress != 0f)
                {
                    UpdateFacial(input.preset, input.easing.Evaluate(0f));
                }
                input.progress = 0f;
            }
        }
    }
Ejemplo n.º 3
0
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        m_TrackBinding = playerData as Light;

        if (m_TrackBinding == null)
        {
            return;
        }

        if (!m_FirstFrameHappened)
        {
            m_DefaultColor           = m_TrackBinding.color;
            m_DefaultIntensity       = m_TrackBinding.intensity;
            m_DefaultBounceIntensity = m_TrackBinding.bounceIntensity;
            m_DefaultRange           = m_TrackBinding.range;
            m_FirstFrameHappened     = true;
        }

        // inputCount是指这个轨上有多少个clip
        // 如果只有一个轨,轨上有3个clip,则inputCount打印为3
        // 如果有两个轨,一个轨上有3个clip,另一个轨上有1个clip,则inputCount打印为3和1
        int   inputCount             = playable.GetInputCount();
        Color blendedColor           = Color.clear;
        float blendedIntensity       = 0f;
        float blendedBounceIntensity = 0f;
        float blendedRange           = 0f;
        float totalWeight            = 0f;
        float greatestWeight         = 0f;
        int   currentInputs          = 0;

        for (int i = 0; i < inputCount; i++)
        {
            float inputWeight = playable.GetInputWeight(i);
            ScriptPlayable <LightControlBehaviour> inputPlayable = (ScriptPlayable <LightControlBehaviour>)playable.GetInput(i);
            LightControlBehaviour input = inputPlayable.GetBehaviour();

            blendedColor           += input.color * inputWeight;
            blendedIntensity       += input.intensity * inputWeight;
            blendedBounceIntensity += input.bounceIntensity * inputWeight;
            blendedRange           += input.range * inputWeight;
            totalWeight            += inputWeight;

            if (inputWeight > greatestWeight)
            {
                greatestWeight = inputWeight;
            }

            if (!Mathf.Approximately(inputWeight, 0f))
            {
                currentInputs++;
            }
        }

        m_TrackBinding.color           = blendedColor + m_DefaultColor * (1f - totalWeight);
        m_TrackBinding.intensity       = blendedIntensity + m_DefaultIntensity * (1f - totalWeight);
        m_TrackBinding.bounceIntensity = blendedBounceIntensity + m_DefaultBounceIntensity * (1f - totalWeight);
        m_TrackBinding.range           = blendedRange + m_DefaultRange * (1f - totalWeight);
    }
Ejemplo n.º 4
0
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        //ScriptPlayable<TimeMachineBehaviour> inputPlayable = (ScriptPlayable<TimeMachineBehaviour>)playable.GetInput(i);
        //Debug.Log(PlayableExtensions.GetTime<ScriptPlayable<TimeMachineBehaviour>>(inputPlayable));

        if (!Application.isPlaying)
        {
            return;
        }

        int inputCount = playable.GetInputCount();

        for (int i = 0; i < inputCount; i++)
        {
            float inputWeight = playable.GetInputWeight(i);
            ScriptPlayable <TimeMachineBehaviour> inputPlayable = (ScriptPlayable <TimeMachineBehaviour>)playable.GetInput(i);
            TimeMachineBehaviour input = inputPlayable.GetBehaviour();

            if (inputWeight > 0.0f)
            {
                if (!input.clipExecuted)
                {
                    switch (input.action)
                    {
                    /*
                     *                      case TimeMachineBehaviour.TimeMachineAction.Pause:
                     *                              if(input.ConditionMet())
                     *                              {
                     *                                      //GameManager.Instance.PauseTimeline(director);   //perlu buat sendiri condition agar bisa keluar dari pause
                     *                                      input.clipExecuted = true; //this prevents the command to be executed every frame of this clip
                     *                              }
                     *                              break;
                     */
                    case TimeMachineBehaviour.TimeMachineAction.JumpToTime:
                    case TimeMachineBehaviour.TimeMachineAction.JumpToMarker:

                        if (input.ConditionMet())
                        {
                            //Rewind
                            if (input.action == TimeMachineBehaviour.TimeMachineAction.JumpToTime)
                            {
                                //Jump to time
                                (playable.GetGraph().GetResolver() as PlayableDirector).time = (double)input.timeToJumpTo;
                            }
                            else if (input.action == TimeMachineBehaviour.TimeMachineAction.JumpToMarker)
                            {
                                //Jump to marker
                                double t = markerClips[input.markerToJumpTo];
                                (playable.GetGraph().GetResolver() as PlayableDirector).time = t;
                            }
                            input.clipExecuted = false;                                     //we want the jump to happen again!
                        }
                        break;
                    }
                }
            }
        }
    }
 public void PreviewEditModePose(Playable playable, SkeletonAnimation spineComponent)
 {
     if (!Application.isPlaying && (spineComponent != null))
     {
         int inputCount = playable.GetInputCount <Playable>();
         int inputPort  = -1;
         for (int i = 0; i < inputCount; i++)
         {
             if (playable.GetInputWeight <Playable>(i) >= 1f)
             {
                 inputPort = i;
             }
         }
         if (inputPort != -1)
         {
             ScriptPlayable <SpineAnimationStateBehaviour> input = (ScriptPlayable <SpineAnimationStateBehaviour>)playable.GetInput <Playable>(inputPort);
             SpineAnimationStateBehaviour behaviour = input.GetBehaviour();
             Skeleton skeleton = spineComponent.Skeleton;
             if ((behaviour.animationReference != null) && (spineComponent.SkeletonDataAsset.GetSkeletonData(true) != behaviour.animationReference.SkeletonDataAsset.GetSkeletonData(true)))
             {
                 object[] args = new object[] { spineComponent.SkeletonDataAsset, behaviour.animationReference.SkeletonDataAsset };
                 Debug.LogWarningFormat("SpineAnimationStateMixerBehaviour tried to apply an animation for the wrong skeleton. Expected {0}. Was {1}", args);
             }
             Spine.Animation from = null;
             float           time = 0f;
             bool            loop = false;
             if ((inputPort != 0) && (inputCount > 1))
             {
                 ScriptPlayable <SpineAnimationStateBehaviour> playable3 = (ScriptPlayable <SpineAnimationStateBehaviour>)playable.GetInput <Playable>((inputPort - 1));
                 SpineAnimationStateBehaviour behaviour2 = playable3.GetBehaviour();
                 from = behaviour2.animationReference.Animation;
                 time = (float)playable3.GetTime <ScriptPlayable <SpineAnimationStateBehaviour> >();
                 loop = behaviour2.loop;
             }
             Spine.Animation animation   = behaviour.animationReference.Animation;
             float           num6        = (float)input.GetTime <ScriptPlayable <SpineAnimationStateBehaviour> >();
             float           mixDuration = behaviour.mixDuration;
             if (!behaviour.customDuration && (from != null))
             {
                 mixDuration = spineComponent.AnimationState.Data.GetMix(from, animation);
             }
             if (((from != null) && (mixDuration > 0f)) && (num6 < mixDuration))
             {
                 skeleton.SetToSetupPose();
                 float alpha = 1f - (num6 / mixDuration);
                 alpha = (alpha <= 0.5f) ? (alpha * 2f) : 1f;
                 from.Apply(skeleton, 0f, time, loop, null, alpha, MixPose.Setup, MixDirection.Out);
                 animation.Apply(skeleton, 0f, num6, behaviour.loop, null, num6 / mixDuration, MixPose.Current, MixDirection.In);
             }
             else
             {
                 skeleton.SetToSetupPose();
                 animation.PoseSkeleton(skeleton, num6, behaviour.loop);
             }
         }
     }
 }
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        m_TrackBinding = playerData as TextMeshPro;

        if (m_TrackBinding == null)
        {
            return;
        }

        if (!m_FirstFrameHappened)
        {
            m_DefaultColor       = m_TrackBinding.color;
            m_DefaultFontSize    = m_TrackBinding.fontSize;
            m_DefaultText        = m_TrackBinding.text;
            m_FirstFrameHappened = true;
        }

        int inputCount = playable.GetInputCount();

        Color blendedColor    = Color.clear;
        float blendedFontSize = 0f;
        float totalWeight     = 0f;
        float greatestWeight  = 0f;
        int   currentInputs   = 0;

        for (int i = 0; i < inputCount; i++)
        {
            float inputWeight = playable.GetInputWeight(i);
            ScriptPlayable <TextMeshSwitcherBehaviour> inputPlayable = (ScriptPlayable <TextMeshSwitcherBehaviour>)playable.GetInput(i);
            TextMeshSwitcherBehaviour input = inputPlayable.GetBehaviour();

            blendedColor    += input.color * inputWeight;
            blendedFontSize += input.fontSize * inputWeight;
            totalWeight     += inputWeight;

            if (inputWeight > greatestWeight)
            {
                m_TrackBinding.text = input.text;
                greatestWeight      = inputWeight;
            }

            if (!Mathf.Approximately(inputWeight, 0f))
            {
                currentInputs++;
            }
        }

        var color = blendedColor + m_DefaultColor * (1f - totalWeight);

        color.a *= totalWeight;
        m_TrackBinding.color    = color;
        m_TrackBinding.fontSize = Mathf.RoundToInt(blendedFontSize + m_DefaultFontSize * (1f - totalWeight));
        if (currentInputs != 1 && 1f - totalWeight > greatestWeight)
        {
            m_TrackBinding.text = m_DefaultText;
        }
    }
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        base.ProcessFrame(playable, info, playerData);

        if (info.deltaTime == 0)
        {
            return;
        }

        Transform trackBinding = playerData as Transform;

        int inputCount = playable.GetInputCount();

        for (int i = 0; i < inputCount; i++)
        {
            ScriptPlayable <SoundTimelineBehaviour> inputBehaviour = (ScriptPlayable <SoundTimelineBehaviour>)playable.GetInput(i);
            SoundTimelineBehaviour input = inputBehaviour.GetBehaviour();

            if (input.triggered)
            {
                input.triggered = false;

                if (Game.SoundSystem == null)
                {
                    GameDebug.LogWarning("SoundTimeline: You should not try to play sound with no soundsystem");
                    return;
                }

                Profiler.BeginSample("Play sound");
                switch (input.position)
                {
                case SoundTimelineBehaviour.SoundPosition.None:
                    //Game.SoundSystem.Play(input.sound);
                    break;

                case SoundTimelineBehaviour.SoundPosition.Position:
                    if (trackBinding == null)
                    {
                        GameDebug.LogError("Cant play timeline sound as no transform is defined for track. Sound:" + input.sound.name);
                        break;
                    }
                    //Game.SoundSystem.Play(input.sound, trackBinding.position);
                    break;

                case SoundTimelineBehaviour.SoundPosition.Follow:
                    if (trackBinding == null)
                    {
                        GameDebug.LogError("Cant play timeline sound as no transform is defined for track. Sound:" + input.sound.name);
                        break;
                    }
                    //Game.SoundSystem.Play(input.sound, trackBinding);
                    break;
                }
                Profiler.EndSample();
            }
        }
    }
Ejemplo n.º 8
0
        public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
        {
            ScriptPlayable <RefControlMixer> mixer = ScriptPlayable <RefControlMixer> .Create(graph, inputCount);

            RefControlMixer behaviour = mixer.GetBehaviour();

            SetContext(behaviour, go);
            return(mixer);
        }
            public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
            {
                ScriptPlayable <SkinnedMeshBlendshapePlayableBehaviour> playable = ScriptPlayable <SkinnedMeshBlendshapePlayableBehaviour> .Create(graph, _data);

                SkinnedMeshBlendshapePlayableBehaviour clone = playable.GetBehaviour();

                clone._clip = this;
                return(playable);
            }
Ejemplo n.º 10
0
        protected override Playable OnCreateArgumentPlayable(PlayableGraph graph, GameObject owner)
        {
            ScriptPlayable <DollCartPlayableBehaviour> playable = ScriptPlayable <DollCartPlayableBehaviour> .Create(graph);

            DollCartPlayableBehaviour behaviour = playable.GetBehaviour();

            behaviour.dollyCart = dollyCart.Resolve(graph.GetResolver());
            return(playable);
        }
Ejemplo n.º 11
0
            public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
            {
                ScriptPlayable <MaterialFloatParamPlayableBehaviour> playable = ScriptPlayable <MaterialFloatParamPlayableBehaviour> .Create(graph, _data);

                MaterialFloatParamPlayableBehaviour clone = playable.GetBehaviour();

                clone._clip = this;
                return(playable);
            }
    // Token: 0x06007B13 RID: 31507 RVA: 0x003A54B0 File Offset: 0x003A36B0
    public virtual Playable DKMHPMOFQGB(PlayableGraph HFJPOOPLNLQ, GameObject BLDHKNGOJKE)
    {
        ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> playable = ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> .Create(HFJPOOPLNLQ, this.template, 1);

        PC2DAddOrRemoveCameraTargetBehaviour behaviour = playable.GetBehaviour();

        behaviour.QFNFCBDQCHQ(this.MCDPGOMJCGH());
        behaviour.cameraTarget = this.cameraTarget.Resolve(HFJPOOPLNLQ.GetResolver());
        return(playable);
    }
Ejemplo n.º 13
0
    // Create the runtime version of the clip, by creating a copy of the template
    public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
    {
        ScriptPlayable <DeactivateObjectBehaviour> playable = ScriptPlayable <DeactivateObjectBehaviour> .Create(graph);

        DeactivateObjectBehaviour playableBehaviour = playable.GetBehaviour();

        playableBehaviour.Target = Target.Resolve(graph.GetResolver());

        return(playable);
    }
Ejemplo n.º 14
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            ScriptPlayable <ConditionsBehavior> playable = ScriptPlayable <ConditionsBehavior> .Create(graph);

            ConditionsBehavior behavior = playable.GetBehaviour();

            behavior.invoker = owner;

            return(playable);
        }
Ejemplo n.º 15
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            ScriptPlayable <EZTransformTweenBehaviour> playable = ScriptPlayable <EZTransformTweenBehaviour> .Create(graph, templateBehaviour);

            EZTransformTweenBehaviour behaviour = playable.GetBehaviour();

            behaviour.startPoint = startPoint.Resolve(graph.GetResolver());
            behaviour.endPoint   = endPoint.Resolve(graph.GetResolver());
            return(playable);
        }
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            ScriptPlayable <HvrActor_AssetBehavior> playable = ScriptPlayable <HvrActor_AssetBehavior> .Create(graph);

            HvrActor_AssetBehavior playableBehaviour = playable.GetBehaviour();

            playableBehaviour.dataGUID = dataGUID;

            return(playable);
        }
    // Create the runtime version of the clip, by creating a copy of the template
    public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
    {
        ScriptPlayable <CameraSwitcher> playable = ScriptPlayable <CameraSwitcher> .Create(graph);

        CameraSwitcher switcher = playable.GetBehaviour();

        switcher.gameobject = gameobject.Resolve(graph.GetResolver());

        return(playable);
    }
Ejemplo n.º 18
0
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            CalculateCurrentClip(playable);

            ClipData data = m_clipsData[m_currentClipIndex];
            ScriptPlayable <DialogueBehaviour> playableInput = data.Input;
            DialogueBehaviour input = playableInput.GetBehaviour();

            ProcessCurrentClip(playable, playerData, input, data);
        }
    // Token: 0x06007AFC RID: 31484 RVA: 0x003A5370 File Offset: 0x003A3570
    public override Playable CreatePlayable(PlayableGraph HFJPOOPLNLQ, GameObject BLDHKNGOJKE)
    {
        ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> playable = ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> .Create(HFJPOOPLNLQ, this.template, 0);

        PC2DAddOrRemoveCameraTargetBehaviour behaviour = playable.GetBehaviour();

        behaviour.ClipReference = this.ClipReference;
        behaviour.cameraTarget  = this.cameraTarget.Resolve(HFJPOOPLNLQ.GetResolver());
        return(playable);
    }
Ejemplo n.º 20
0
    // Create the runtime version of the clip, by creating a copy of the template
    public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
    {
        ScriptPlayable <PostProcessingSwitcher> playable = ScriptPlayable <PostProcessingSwitcher> .Create(graph);

        PostProcessingSwitcher switcher = playable.GetBehaviour();

        switcher.postProcessVolume = postProcessVolume.Resolve(graph.GetResolver());

        return(playable);
    }
    // Token: 0x06007AF6 RID: 31478 RVA: 0x003A52D0 File Offset: 0x003A34D0
    public virtual Playable GLGOHFMKQIM(PlayableGraph HFJPOOPLNLQ, GameObject BLDHKNGOJKE)
    {
        ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> playable = ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> .Create(HFJPOOPLNLQ, this.template, 1);

        PC2DAddOrRemoveCameraTargetBehaviour behaviour = playable.GetBehaviour();

        behaviour.OCCEQIMQPOQ(this.JHFGIPGEDLE());
        behaviour.cameraTarget = this.cameraTarget.Resolve(HFJPOOPLNLQ.GetResolver());
        return(playable);
    }
    // Token: 0x06007B07 RID: 31495 RVA: 0x003A5460 File Offset: 0x003A3660
    public virtual Playable ONJNQQEJOFB(PlayableGraph HFJPOOPLNLQ, GameObject BLDHKNGOJKE)
    {
        ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> playable = ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> .Create(HFJPOOPLNLQ, this.template, 0);

        PC2DAddOrRemoveCameraTargetBehaviour behaviour = playable.GetBehaviour();

        behaviour.LHCJHQGPQGQ(this.MCDPGOMJCGH());
        behaviour.cameraTarget = this.cameraTarget.Resolve(HFJPOOPLNLQ.GetResolver());
        return(playable);
    }
    // Token: 0x06007B04 RID: 31492 RVA: 0x003A5410 File Offset: 0x003A3610
    public virtual Playable FBEJCNDMQML(PlayableGraph HFJPOOPLNLQ, GameObject BLDHKNGOJKE)
    {
        ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> playable = ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> .Create(HFJPOOPLNLQ, this.template, 0);

        PC2DAddOrRemoveCameraTargetBehaviour behaviour = playable.GetBehaviour();

        behaviour.QMJJLCJFFCI(this.IKEHGIMFNCP());
        behaviour.cameraTarget = this.cameraTarget.Resolve(HFJPOOPLNLQ.GetResolver());
        return(playable);
    }
    // Token: 0x06007AFB RID: 31483 RVA: 0x003A5320 File Offset: 0x003A3520
    public virtual Playable LPOJNJKPQOB(PlayableGraph HFJPOOPLNLQ, GameObject BLDHKNGOJKE)
    {
        ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> playable = ScriptPlayable <PC2DAddOrRemoveCameraTargetBehaviour> .Create(HFJPOOPLNLQ, this.template, 0);

        PC2DAddOrRemoveCameraTargetBehaviour behaviour = playable.GetBehaviour();

        behaviour.OMNJGJKCGHB(this.ClipReference);
        behaviour.cameraTarget = this.cameraTarget.Resolve(HFJPOOPLNLQ.GetResolver());
        return(playable);
    }
Ejemplo n.º 25
0
            public override void ProcessFrame(Playable playable, FrameData info, object playerData)
            {
                _trackBinding = playerData as Transform;

                if (_trackBinding == null)
                    return;

                if (_firstFrame)
                {
                    _defaultPosition = _trackBinding.position;
                    _defaultRotation = _trackBinding.rotation;
                    _firstFrame = false;
                }

                Vector3 position = _defaultPosition;
                Quaternion rotation  = _defaultRotation;

                int numInputs = playable.GetInputCount();

                for (int i = 0; i < numInputs; i++)
                {
                    ScriptPlayable<PathPlayableBehaviour> scriptPlayable = (ScriptPlayable<PathPlayableBehaviour>)playable.GetInput(i);
                    PathPlayableBehaviour inputBehaviour = scriptPlayable.GetBehaviour();

                    if (inputBehaviour != null && inputBehaviour._path != null)
                    {
                        float inputWeight = playable.GetInputWeight(i);

                        if (inputWeight > 0.0f)
                        {
                            TimelineClip clip = TimelineUtils.GetClip(_trackAsset, inputBehaviour._clipAsset);

                            if (clip != null)
                            {
                                double clipStart = clip.hasPreExtrapolation ? clip.extrapolatedStart : clip.start;
                                double clipDuration = clip.hasPreExtrapolation || clip.hasPostExtrapolation ? clip.extrapolatedDuration : clip.duration;

                                if (_director.time >= clipStart && _director.time <= clipStart + clipDuration)
                                {
                                    //To do handle loops etc

                                    double t = Mathf.Clamp01((float)(_director.time - clip.start) / (float)clip.duration);
                                    PathPosition pos = inputBehaviour._path.GetPoint((float)t);

                                    position = Vector3.Lerp(position, pos._pathPosition, inputWeight);
                                    rotation = Quaternion.Slerp(rotation, Quaternion.LookRotation(pos._pathForward, pos._pathUp), inputWeight);
                                }
                            }
                        }
                    }
                }

                _trackBinding.position = position;
                _trackBinding.rotation = rotation;
            }
Ejemplo n.º 26
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            List <Playable> playableList = new List <Playable>();
            GameObject      gameObject   = GetGameObjectBinding(go.GetComponent <PlayableDirector>());

            if (this.prefabGameObject != null)
            {
                Transform parentTransform = !(gameObject != null) ? (Transform)null : gameObject.transform;
                ScriptPlayable <PrefabControlPlayable> scriptPlayable = PrefabControlPlayable.Create(graph, this.prefabGameObject, parentTransform);
                gameObject = scriptPlayable.GetBehaviour().prefabInstance;
                playableList.Add((Playable)scriptPlayable);
            }

            this.UpdateDurationAndLoopFlag(gameObject);
            if (gameObject == null)
            {
                return(Playable.Create(graph, 0));
            }

            PlayableDirector component = go.GetComponent <PlayableDirector>();

            if (component != null)
            {
                this.m_ControlDirectorAsset = component.playableAsset;
            }

            if (go == gameObject && this.prefabGameObject == null)
            {
                UnityEngine.Debug.LogWarning((object)("Control Playable (" + this.name + ") is referencing the same PlayableDirector component than the one in which it is playing."));
                this.active = false;
                if (!this.searchHierarchy)
                {
                    this.updateDirector = false;
                }
            }

            if (this.active)
            {
                this.CreateActivationPlayable(gameObject, graph, playableList);
            }
            if (this.updateDirector)
            {
                this.SearchHierarchyAndConnectDirector(gameObject, graph, playableList);
            }
            if (this.updateParticle)
            {
                this.SearchHiearchyAndConnectParticleSystem(gameObject, graph, playableList);
            }
            if (this.updateITimeControl)
            {
                this.SearchHierarchyAndConnectControlableScripts(gameObject, graph, playableList);
            }

            return(this.ConnectPlayablesToMixer(graph, playableList));
        }
Ejemplo n.º 27
0
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            string sharedColorName = "";

            avatar = playerData as DynamicCharacterAvatar;

            if (avatar == null)
            {
                if (Debug.isDebugBuild)
                {
                    Debug.LogWarning("No DynamicCharacterAvatar set for UmaColor Playable!");
                }
                return;
            }

            int  inputCount   = playable.GetInputCount();
            bool colorUpdated = false;

            if (inputCount <= 0)
            {
                return;
            }

            UmaColorBehaviour firstBehaviour = ((ScriptPlayable <UmaColorBehaviour>)playable.GetInput(0)).GetBehaviour();
            Color             finalColor     = Color.black;

            if (avatar.GetColor(firstBehaviour.sharedColorName) != null)
            {
                finalColor = avatar.GetColor(firstBehaviour.sharedColorName).color;
            }

            elapsedTime += info.deltaTime;

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                ScriptPlayable <UmaColorBehaviour> inputPlayable = (ScriptPlayable <UmaColorBehaviour>)playable.GetInput(i);
                UmaColorBehaviour input = inputPlayable.GetBehaviour();

                sharedColorName = input.sharedColorName;
                finalColor      = (finalColor * (1f - inputWeight)) + (input.color * inputWeight);
            }

            if (elapsedTime >= timeStep)
            {
                elapsedTime = 0f;
                avatar.SetColor(sharedColorName, finalColor);
                colorUpdated = true;
            }

            if (colorUpdated)
            {
                avatar.UpdateColors(true);
            }
        }
Ejemplo n.º 28
0
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        m_TrackBinding = playerData as SpriteRenderer;

        if (m_TrackBinding == null)
        {
            return;
        }

        if (m_TrackBinding.color != m_AssignedColor)
        {
            m_DefaultColor = m_TrackBinding.color;
        }
        if (m_TrackBinding.enabled != m_AssignedEnabled)
        {
            m_DefaultEnabled = m_TrackBinding.enabled;
        }

        int inputCount = playable.GetInputCount();

        Color blendedColor   = Color.clear;
        float totalWeight    = 0f;
        float greatestWeight = 0f;
        int   currentInputs  = 0;

        for (int i = 0; i < inputCount; i++)
        {
            float inputWeight = playable.GetInputWeight(i);
            ScriptPlayable <SpritePlayableBehaviour> inputPlayable = (ScriptPlayable <SpritePlayableBehaviour>)playable.GetInput(i);
            SpritePlayableBehaviour input = inputPlayable.GetBehaviour();

            blendedColor += input.color * inputWeight;
            totalWeight  += inputWeight;

            if (inputWeight > greatestWeight)
            {
                m_AssignedEnabled      = input.enabled;
                m_TrackBinding.enabled = m_AssignedEnabled;
                greatestWeight         = inputWeight;
            }

            if (!Mathf.Approximately(inputWeight, 0f))
            {
                currentInputs++;
            }
        }

        m_AssignedColor      = blendedColor + m_DefaultColor * (1f - totalWeight);
        m_TrackBinding.color = m_AssignedColor;

        if (currentInputs != 1 && 1f - totalWeight > greatestWeight)
        {
            m_TrackBinding.enabled = m_DefaultEnabled;
        }
    }
Ejemplo n.º 29
0
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            dollyCart = playerData as CinemachineDollyCart;
            // float finalSpeed = 0f;
            // float finalWeight = 0f;

            if (!dollyCart)
            {
                return;
            }

            CacheStartState();

            int inputCount = playable.GetInputCount(); //get the number of all clips on this track


            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                ScriptPlayable <CMDollyCartBehaviour> inputPlayable = (ScriptPlayable <CMDollyCartBehaviour>)playable.GetInput(i);
                CMDollyCartBehaviour input = inputPlayable.GetBehaviour();

                // finalWeight += inputWeight;

                // Use the above variables to process each frame of this playable.
                // finalSpeed += input.GetSpeed() * inputWeight;
                if (inputWeight == 1)
                {
                    // var maxTime = Mathf.Min((float)inputPlayable.GetTime(), (float)inputPlayable.GetDuration());
                    dollyCart.m_Speed = 0;

                    switch (input.positionMode)
                    {
                    case CMDollyCartBehaviour.PositionMode.BaseOnOriginal:
                        dollyCart.m_Position = m_DefaultPosition + (float)(inputPlayable.GetTime() * input.speed);
                        break;

                    case CMDollyCartBehaviour.PositionMode.CustomStart:
                        dollyCart.m_Position = input.customStart + (float)(inputPlayable.GetTime() * input.speed);
                        break;

                    case CMDollyCartBehaviour.PositionMode.DeltaTime:
                        dollyCart.m_Position += (float)(info.deltaTime * input.speed);
                        break;
                    }
                }
            }

            // Debug.Log(finalWeight);

            // dollyCart.m_Speed = 0;

            // if (finalWeight > 0)
            //     dollyCart.m_Position = m_DefaultPosition + (float)(playable.GetTime() * finalSpeed);
        }
Ejemplo n.º 30
0
    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        ScriptPlayable <AkEventPlayableBehavior> playable = ScriptPlayable <AkEventPlayableBehavior> .Create(graph);

        AkEventPlayableBehavior b = playable.GetBehaviour();

        initializeBehaviour(graph, b, owner);
        b.akEventMinDuration = eventDurationMin;
        b.akEventMaxDuration = eventDurationMax;
        return(playable);
    }