Пример #1
0
 void StartCutscene()
 {
     //utility function to set up start state
     state  = CutsceneState.START;
     t      = 0.0f;
     t_goal = 1.0f;
 }
Пример #2
0
        /// <summary>
        /// Pause the playback of this cutscene.
        /// </summary>
        public void Pause()
        {
            if (state == CutsceneState.Playing)
            {
                StopCoroutine("updateCoroutine");
            }
            if (state == CutsceneState.PreviewPlaying || state == CutsceneState.Playing || state == CutsceneState.Scrubbing)
            {
                {
                    var __array2       = GetTrackGroups();
                    var __arrayLength2 = __array2.Length;
                    for (int __i2 = 0; __i2 < __arrayLength2; ++__i2)
                    {
                        var trackGroup = (TrackGroup)__array2[__i2];
                        {
                            trackGroup.Pause();
                        }
                    }
                }
            }
            state = CutsceneState.Paused;

            if (CutscenePaused != null)
            {
                CutscenePaused(this, new CutsceneEventArgs());
            }
        }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        switch (State)
        {
        case CutsceneState.WaitingToStart:
            StartCutscene();
            break;

        case CutsceneState.NextStep:
            m_step++;
            switch (m_step)
            {
            case 1:
                StartCoroutine("WalkInTogether");
                State = CutsceneState.WaitingForStep;
                break;

            case 2:
                StartCoroutine("FaceEachOtherInTogether");
                State = CutsceneState.WaitingForStep;
                break;

            default:
                State = CutsceneState.Done;
                break;
            }
            break;

        default:
            break;
        }
    }
Пример #4
0
        public void Awake()
        {
            if (CurrentCutsceneAnchor == null)
            {
                return;
            }
            //there can only be one cutscene at a time
            //GameObject.Destroy (this);
            //return;
            State                   = CutsceneState.NotStarted;
            CurrentCutscene         = this;
            transform.parent        = CurrentCutsceneAnchor.transform;
            transform.localPosition = AnchorOffset;
            transform.localRotation = Quaternion.identity;

            mCameraClipDistanceOnStartup     = GameManager.Get.GameCamera.farClipPlane;
            mCameraNearClipDistanceOnStartup = GameManager.Get.GameCamera.nearClipPlane;

                                                #if UNITY_EDITOR
            VRMode = (VRManager.VRMode | VRManager.VRTestingMode && Profile.Get.CurrentPreferences.Video.VRStaticCameraCutscenes);
                                                #else
            VRMode = (VRManager.VRMode && Profile.Get.CurrentPreferences.Video.VRStaticCameraCutscenes);
                                                #endif

            if (!VRMode)
            {
                mCameraParentOnStart = GameManager.Get.GameCamera.transform.parent;
                GameManager.Get.GameCamera.transform.parent = null;
            }

            OnCutsceneStart.SafeInvoke();
        }
Пример #5
0
        void PlayScript(StoryCutsceneIni ct, CutsceneState state)
        {
            ui.Visible = false;
            cState     = CutsceneState.Regular;
            string scName = ct.Encounters[0].Action;

            if (!string.IsNullOrEmpty(ct.Encounters[0].Offer))
            {
                scName = ct.Encounters[0].Offer;
                cState = CutsceneState.Offer;
            }
            switch (state)
            {
            case CutsceneState.Decision:
                scName = ct.Encounters[0].Decision;
                cState = state;
                break;

            case CutsceneState.Accept:
                scName = ct.Encounters[0].Accept;
                cState = state;
                break;

            case CutsceneState.Reject:
                scName = ct.Encounters[0].Reject;
                cState = state;
                break;
            }
            var script = new ThnScript(session.Game.GameData.ResolveDataPath(scName));

            currentCutscene = ct;
            RoomDoSceneScript(script, ScriptState.Cutscene);
        }
Пример #6
0
        public void Update(PerspectiveCamera camera, Seconds elapsed)
        {
            if (this.state == CutsceneState.Stopped && Keyboard.GetState().IsKeyDown(Keys.I))
            {
                this.state = CutsceneState.Starting;
            }

            if (this.state != CutsceneState.Stopped)
            {
                if (this.Waypoints.Count < 2)
                {
                    return;
                }

                switch (this.state)
                {
                case CutsceneState.Starting:
                    this.DoStart(camera);
                    break;

                case CutsceneState.Running:
                    this.DoRun(camera, elapsed);
                    break;
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Pause the playback of this cutscene.
        /// </summary>
        public void Pause()
        {
#if PROFILE_FILE
            Profiler.BeginSample("Cutscene.Pause");
#endif // PROFILE_FILE
            if (state == CutsceneState.Playing)
            {
                StopCoroutine("updateCoroutine");
            }
            if (state == CutsceneState.PreviewPlaying || state == CutsceneState.Playing || state == CutsceneState.Scrubbing)
            {
                var list   = GetTrackGroups();
                var length = list.Length;
                for (var i = 0; i < length; i++)
                {
                    var trackGroup = list[i];
                    trackGroup.Pause();
                }
            }
            state = CutsceneState.Paused;

            if (CutscenePaused != null)
            {
                CutscenePaused(this, new CutsceneEventArgs());
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }
Пример #8
0
 public CutsceneSystem(IComponentContainer <Waypoint> waypoints)
 {
     this.Waypoints    = waypoints;
     this.state        = CutsceneState.Stopped;
     this.CameraSpring = new SpringController();
     this.LookAtSpring = new SpringController();
 }
Пример #9
0
        /// <summary>
        /// Preview play readies the cutscene to be played in edit mode. Never use for runtime.
        /// This is necessary for playing the cutscene in edit mode.
        /// </summary>
        public void PreviewPlay()
        {
            if (state == CutsceneState.Inactive)
            {
                EnterPreviewMode();
            }
            else if (state == CutsceneState.Paused)
            {
                resume();
            }

            if (Application.isPlaying)
            {
                state = CutsceneState.Playing;
            }
            else
            {
                state = CutsceneState.PreviewPlaying;
#if UNITY_EDITOR
                if (!UnityEditor.AnimationMode.InAnimationMode())
                {
                    UnityEditor.AnimationMode.StartAnimationMode();
                }
#endif
            }
        }
Пример #10
0
    public static IGameState GetState(int index)
    {
        IGameState state;

        switch (index)
        {
        case 0:
            state = new LoadingState();
            break;

        case 1:
            state = new MenuState();
            break;

        case 2:
            state = new OverworldState();
            break;

        case 3:
            state = new CutsceneState();
            break;

        default:
            state = new LoadingState();
            break;
        }
        return(state);
    }
Пример #11
0
        /// <summary>
        /// Play the cutscene from it's given running time to a new time
        /// </summary>
        /// <param name="newTime">The new time to make up for</param>
        public void ScrubToTime(float newTime)
        {
            float deltaTime = newTime - this.RunningTime;

            state = CutsceneState.Scrubbing;
            UpdateCutscene(deltaTime);
        }
Пример #12
0
        /// <summary>
        /// Play the cutscene from it's given running time to a new time
        /// </summary>
        /// <param name="newTime">The new time to make up for</param>
        public void ScrubToTime(float newTime)
        {
            float deltaTime = Mathf.Clamp(newTime, 0, Duration) - this.RunningTime;

            state = CutsceneState.Scrubbing;
            if (deltaTime != 0)
            {
                if (deltaTime > (1 / 30f))
                {
                    float prevTime = RunningTime;
                    {
                        var __list5      = getMilestones(RunningTime + deltaTime);
                        var __listCount5 = __list5.Count;
                        for (int __i5 = 0; __i5 < __listCount5; ++__i5)
                        {
                            var milestone = (float)__list5[__i5];
                            {
                                float delta = milestone - prevTime;
                                UpdateCutscene(delta);
                                prevTime = milestone;
                            }
                        }
                    }
                }
                else
                {
                    UpdateCutscene(deltaTime);
                }
            }
            else
            {
                Pause();
            }
        }
Пример #13
0
        /// <summary>
        /// Play the cutscene from it's given running time to a new time
        /// </summary>
        /// <param name="newTime">The new time to make up for</param>
        public void ScrubToTime(float newTime)
        {
            float deltaTime = Mathf.Clamp(newTime, 0, Duration) - this.RunningTime;

            state = CutsceneState.Scrubbing;
            if (deltaTime != 0)
            {
                if (deltaTime > (1 / 30f))
                {
                    float        prevTime   = RunningTime;
                    List <float> milestones = getMilestones(RunningTime + deltaTime);
                    for (int i = 0; i < milestones.Count; i++)
                    {
                        float delta = milestones[i] - prevTime;
                        UpdateCutscene(delta);
                        prevTime = milestones[i];
                    }
                }
                else
                {
                    UpdateCutscene(deltaTime);
                }
            }
            else
            {
                Pause();
            }
        }
        /// <summary>
        /// Play the cutscene from it's given running time to a new time
        /// </summary>
        /// <param name="newTime">The new time to make up for</param>
        public void ScrubToTime(float newTime)
        {
            float deltaTime = Mathf.Clamp(newTime, 0, Duration) - this.RunningTime;

            state = CutsceneState.Scrubbing;
            if (deltaTime != 0)
            {
                if (deltaTime > (1 / 30f))
                {
                    float prevTime = RunningTime;
                    foreach (float milestone in getMilestones(RunningTime + deltaTime))
                    {
                        float delta = milestone - prevTime;
                        UpdateCutscene(delta);
                        prevTime = milestone;
                    }
                }
                else
                {
                    UpdateCutscene(deltaTime);
                }
            }
            else
            {
                Pause();
            }
        }
Пример #15
0
        /// <summary>
        /// Play the cutscene from it's given running time to a new time
        /// </summary>
        /// <param name="newTime">The new time to make up for</param>
        public void ScrubToTime(float newTime)
        {
            float deltaTime = Mathf.Clamp(newTime, 0, Duration) - this.RunningTime;

            state = CutsceneState.Scrubbing;
            if (deltaTime != 0)
            {
                if (deltaTime > (1 / 30f))
                {
                    float prevTime = RunningTime;
                    var   list     = getMilestones(RunningTime + deltaTime);
                    var   count    = list.Count;
                    for (var i = 0; i < count; i++)
                    {
                        var   milestone = list[i];
                        float delta     = milestone - prevTime;
                        UpdateCutscene(delta);
                        prevTime = milestone;
                    }
                }
                else
                {
                    UpdateCutscene(deltaTime);
                }
            }
            else
            {
                Pause();
            }
        }
 /// <summary>
 /// Skip the cutscene to the end and stop it
 /// </summary>
 public void Skip()
 {
     if (isSkippable)
     {
         SetRunningTime(this.Duration);
         state = CutsceneState.Inactive;
         Stop();
     }
 }
Пример #17
0
 /// <summary>
 /// Set the cutscene into an active state at the specified running time.
 /// </summary>
 /// <param name="time">The new running time to be set.</param>
 public void EnterPreviewMode(float time)
 {
     if (state == CutsceneState.Inactive)
     {
         initialize();
         bake();
         SetRunningTime(time);
         state = CutsceneState.Paused;
     }
 }
Пример #18
0
        private IEnumerator freshPlay()
        {
            yield return(StartCoroutine(PreparePlay()));

            // Wait one frame.
            yield return(null);

            // Beging playing
            state = CutsceneState.Playing;
            StartCoroutine(updateCoroutine());
        }
Пример #19
0
 /// <summary>
 /// Plays/Resumes the cutscene from inactive/paused states using a Coroutine.
 /// </summary>
 public void Play()
 {
     if (state == CutsceneState.Inactive)
     {
         StartCoroutine(freshPlay());
     }
     else if (state == CutsceneState.Paused)
     {
         state = CutsceneState.Playing;
         StartCoroutine(updateCoroutine());
     }
 }
Пример #20
0
    IEnumerator FaceEachOtherInTogether()
    {
        while (m_player.transform.position.x < m_wife.transform.position.x + 0.5f)
        {
            m_player.GetComponent <Rigidbody2D>().velocity = m_player.maxSpeed * Time.deltaTime * Vector2.right;
            yield return(null);
        }
        m_player.State = new ActorStandingState();
        m_player.Direction.Direction = MovementDirection.Left;

        State = CutsceneState.NextStep;
    }
Пример #21
0
 /// <summary>
 /// Set the cutscene into an active state.
 /// </summary>
 public void EnterPreviewMode()
 {
     if (state == CutsceneState.Inactive)
     {
         initialize();
         foreach (TrackGroup group in this.TrackGroups)
         {
             group.SetRunningTime(RunningTime);
         }
         state = CutsceneState.Paused;
     }
 }
Пример #22
0
        /// <summary>
        /// Preview play readies the cutscene to be played using UpdateCutscene(). Play() should be used in most cases.
        /// This is necessary for playing the cutscene in edit mode.
        /// </summary>
        public void PreviewPlay()
        {
            if (state == CutsceneState.Inactive)
            {
                EnterPreviewMode();
            }
            else if (state == CutsceneState.Paused)
            {
                resume();
            }

            state = CutsceneState.PreviewPlaying;
        }
Пример #23
0
        /// <summary>
        /// Stops the cutscene.
        /// </summary>
        public void Stop()
        {
            state            = CutsceneState.Inactive;
            this.RunningTime = 0f;
            foreach (TrackGroup trackGroup in this.TrackGroups)
            {
                trackGroup.Stop();
            }

            if (state == CutsceneState.Playing)
            {
                StopCoroutine("updateCoroutine");
            }
        }
Пример #24
0
 /// <summary>
 /// Plays/Resumes the cutscene from inactive/paused states using a Coroutine.
 /// </summary>
 public void Play()
 {
     if (state == CutsceneState.Inactive)
     {
         state = CutsceneState.Playing;
         initialize();
         StartCoroutine("updateCoroutine");
     }
     else if (state == CutsceneState.Paused)
     {
         state = CutsceneState.Playing;
         StartCoroutine("updateCoroutine");
     }
 }
Пример #25
0
        /// <summary>
        /// Skip the cutscene to the end and stop it
        /// </summary>
        public void Skip()
        {
#if PROFILE_FILE
            Profiler.BeginSample("Cutscene.Skip");
#endif // PROFILE_FILE
            if (isSkippable)
            {
                SetRunningTime(this.Duration);
                state = CutsceneState.Inactive;
                Stop();
#if PROFILE_FILE
                Profiler.EndSample();
#endif // PROFILE_FILE
            }
        }
Пример #26
0
 public void TryToFinish()
 {
     if (State == CutsceneState.Idling)
     {
         State = CutsceneState.Finishing;
         if (!string.IsNullOrEmpty(CameraAnimationFinishing))
         {
             CameraSeat.GetComponent <Animation>().Play(CameraAnimationFinishing, AnimationPlayMode.Stop);
         }
         if (!string.IsNullOrEmpty(LookTargetAnimationFinishing))
         {
             CameraLookTarget.GetComponent <Animation>().Play(LookTargetAnimationStarting, AnimationPlayMode.Stop);
         }
     }
 }
Пример #27
0
        /// <summary>
        /// Stops the cutscene.
        /// </summary>
        public void Stop()
        {
            this.runningTime = 0f;


            if (!resetPositionOnEnd)
            {
                TrackGroup[] trackGroups = GetTrackGroups();
                for (int i = 0; i < trackGroups.Length; i++)
                {
                    trackGroups[i].Stop();
                }

                if (state != CutsceneState.Inactive)
                {
                    revert();
                }
            }



            if (state == CutsceneState.Playing)
            {
                StopCoroutine("updateCoroutine");
                if (state == CutsceneState.Playing && isLooping)
                {
                    state = CutsceneState.Inactive;
                    Play();
                }
                else
                {
                    state = CutsceneState.Inactive;
                }
            }
            else
            {
                state = CutsceneState.Inactive;
            }

            if (state == CutsceneState.Inactive)
            {
                if (CutsceneFinished != null)
                {
                    CutsceneFinished(this, new CutsceneEventArgs());
                }
            }
        }
Пример #28
0
        /// <summary>
        /// Stops the cutscene.
        /// </summary>
        public void Stop()
        {
#if PROFILE_FILE
            Profiler.BeginSample("Cutscene.Stop");
#endif // PROFILE_FILE
            this.RunningTime = 0f;
            var list = GetTrackGroups();

            var length = list.Length;
            for (var i = 0; i < length; i++)
            {
                var group = list[i];
                group.Stop();
            }

            revert();

            if (state == CutsceneState.Playing)
            {
                StopCoroutine("updateCoroutine");
                if (state == CutsceneState.Playing && isLooping)
                {
                    state = CutsceneState.Inactive;
                    Play();
                }
                else
                {
                    state = CutsceneState.Inactive;
                }
            }
            else
            {
                state = CutsceneState.Inactive;
            }

            if (state == CutsceneState.Inactive)
            {
                if (CutsceneFinished != null)
                {
                    CutsceneFinished(this, new CutsceneEventArgs());
                }
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }
Пример #29
0
        private void DoStart(PerspectiveCamera camera)
        {
            this.distanceCovered = 0.0f;

            this.beforeIndex = 0;
            this.targetIndex = 1;

            var before = this.Waypoints[this.beforeIndex];
            var target = this.Waypoints[this.targetIndex];

            this.CameraSpring.Reset(before.Position);
            this.LookAtSpring.Reset(before.LookAt);

            camera.Move(before.Position, before.LookAt);

            this.state = CutsceneState.Running;
        }
Пример #30
0
        /// <summary>
        /// Plays/Resumes the cutscene from inactive/paused states using a Coroutine.
        /// </summary>
        public void Play()
        {
            if (state == CutsceneState.Inactive)
            {
                StartCoroutine(freshPlay());
            }
            else if (state == CutsceneState.Paused)
            {
                state = CutsceneState.Playing;
                StartCoroutine(updateCoroutine());
            }

            if (CutsceneStarted != null)
            {
                CutsceneStarted(this, new CutsceneEventArgs());
            }
        }
Пример #31
0
 /// <summary>
 /// Plays/Resumes the cutscene from inactive/paused states using a Coroutine.
 /// </summary>
 public void Play()
 {
     if (state == CutsceneState.Inactive)
     {
         state = CutsceneState.Playing;
         if (!hasBeenOptimized)
         {
             Optimize();
         }
         if (!hasBeenInitialized)
         {
             initialize();
         }
         StartCoroutine("updateCoroutine");
     }
     else if (state == CutsceneState.Paused)
     {
         state = CutsceneState.Playing;
         StartCoroutine("updateCoroutine");
     }
 }
Пример #32
0
        /// <summary>
        /// Stops the cutscene.
        /// </summary>
        public void Stop()
        {
            this.RunningTime = 0f;
            
            foreach (TrackGroup trackGroup in GetTrackGroups())
            {
                trackGroup.Stop();
            }

            revert();

            if (state == CutsceneState.Playing)
            {
                StopCoroutine("updateCoroutine");
                if (state == CutsceneState.Playing && isLooping)
                {
                    state = CutsceneState.Inactive;
                    Play();
                }
                else
                {
                    state = CutsceneState.Inactive;
                }
            }
            else
            {
                state = CutsceneState.Inactive;
            }

            if (state == CutsceneState.Inactive)
            {
                if (CutsceneFinished != null)
                {
                    CutsceneFinished(this, new CutsceneEventArgs());
                }
            }
        }
Пример #33
0
        /// <summary>
        /// Pause the playback of this cutscene.
        /// </summary>
        public void Pause()
        {
            if (state == CutsceneState.Playing)
            {
                StopCoroutine("updateCoroutine");
            }
            if (state == CutsceneState.PreviewPlaying || state == CutsceneState.Playing || state == CutsceneState.Scrubbing)
            {
                foreach (TrackGroup trackGroup in GetTrackGroups())
                {
                    trackGroup.Pause();
                }
            }
            state = CutsceneState.Paused;

            if (CutscenePaused != null)
            {
                CutscenePaused(this, new CutsceneEventArgs());
            }
        }
Пример #34
0
 /// <summary>
 /// Skip the cutscene to the end and stop it
 /// </summary>
 public void Skip()
 {
     if (isSkippable)
     {
         SetRunningTime(this.Duration);
         state = CutsceneState.Inactive;
         Stop();
     }
 }
Пример #35
0
    // Update is called once per frame
    void Update()
    {
        if ( Input.GetKeyDown ( KeyCode.Space ) || Input.GetKeyDown ( KeyCode.Return ) )
        {
            state = CutsceneState.END;
        }

        #region state management
        t += Time.deltaTime;
        if ( t >= t_goal ) //state transition
        {
            #region start
            if ( state == CutsceneState.START )
            {
                if ( scenes.Count > 0 )
                {
                    state = CutsceneState.FADE_IN;
                    //copy constructor: current scene = scene[0]
                    current_scene = new CutsceneData( ((CutsceneData)scenes[0]).t, ((CutsceneData)scenes[0]).text, ((CutsceneData)scenes[0]).img_index );

                    t = 0.0f;
                    t_goal = 1.0f; //constant fade in time
                    text.text = current_scene.text;
                    foreground.texture = fgs[current_scene.img_index];

                    //delete data
                    scenes.RemoveAt ( 0 );
                }
                else
                {
                    t = 0.0f;
                    t_goal = 1.0f;	//constant end fade out time
                    //no new scenes, end.
                    state = CutsceneState.END;
                }
            }
            #endregion
            #region end
            else if ( state == CutsceneState.END )
            {
                //it's over! Do nothing.
                state = CutsceneState.OFF;
            }
            #endregion
            #region fade in
            else if ( state == CutsceneState.FADE_IN )
            {
                t = 0.0f;
                t_goal = current_scene.t; //wait for the allotted time
                state = CutsceneState.WAIT;
            }
            #endregion
            #region wait
            else if ( state == CutsceneState.WAIT )
            {
                t = 0.0f;
                t_goal = 1.0f; //constant fade out time
                state = CutsceneState.FADE_OUT;
            }
            #endregion
            #region fade out
            else if ( state == CutsceneState.FADE_OUT )
            {
                if ( scenes.Count > 0 )
                {
                    state = CutsceneState.FADE_IN;
                    //copy constructor: current scene = scene[0]
                    current_scene = new CutsceneData( ((CutsceneData)scenes[0]).t, ((CutsceneData)scenes[0]).text, ((CutsceneData)scenes[0]).img_index );

                    t = 0.0f;
                    t_goal = 1.0f; //constant start fade in time
                    text.text = current_scene.text;
                    foreground.texture = fgs[current_scene.img_index];
                    //TODO: img

                    //delete data
                    scenes.RemoveAt ( 0 );
                }
                else
                {
                    t = 0.0f;
                    t_goal = 1.0f; //constant end fade out time
                    //no new scenes, end.
                    state = CutsceneState.END;
                }
            }
            #endregion
        }
        #endregion

        #region alpha control
        //Blending.
        if ( state == CutsceneState.START )
        {
            //fade bg in
            background.color = new Color( 1.0f, 1.0f, 1.0f, t / t_goal );
            //hide text
            text.color = new Color( 1.0f, 1.0f, 1.0f, 0.0f );
            //hide fg
            foreground.color = new Color( 1.0f, 1.0f, 1.0f, 0.0f );
        }
        else if ( state == CutsceneState.END )
        {
            //fade bg out
            background.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f - ( t / t_goal ) );
            //hide text
            text.color = new Color( 1.0f, 1.0f, 1.0f, 0.0f );
            //hide fg
            foreground.color = new Color( 1.0f, 1.0f, 1.0f, 0.0f );

        }
        else if ( state == CutsceneState.FADE_IN )
        {
            //full alpha bg
            background.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f );
            //fade text in
            text.color = new Color( 1.0f, 1.0f, 1.0f, t / t_goal );
            //fade fg in
            foreground.color = new Color( 1.0f, 1.0f, 1.0f, t / t_goal );
        }
        else if ( state == CutsceneState.WAIT )
        {
            //full alpha bg
            background.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f );
            //full alpha text
            text.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f );
            //full alpha fg
            foreground.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f );
        }
        else if ( state == CutsceneState.FADE_OUT )
        {
            //full alpha bg
            background.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f );
            //fade text out
            text.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f - ( t / t_goal ) );
            //fade fg out
            foreground.color = new Color( 1.0f, 1.0f, 1.0f, 1.0f - ( t / t_goal ) );
        }
        else
        {
            //off
            background.color = new Color( 1.0f, 1.0f, 1.0f, 0.0f );
            text.color = new Color( 1.0f, 1.0f, 1.0f, 0.0f );
            foreground.color = new Color( 1.0f, 1.0f, 1.0f, 0.0f );
        }
        #endregion
    }
Пример #36
0
        /// <summary>
        /// Play the cutscene from it's given running time to a new time
        /// </summary>
        /// <param name="newTime">The new time to make up for</param>
        public void ScrubToTime(float newTime)
        {
            float deltaTime = Mathf.Clamp(newTime, 0, Duration) - this.RunningTime;

            state = CutsceneState.Scrubbing;
            if (deltaTime != 0)
            {
                if (deltaTime > (1 / 30f))
                {
                    float prevTime = RunningTime;
                    foreach (float milestone in getMilestones(RunningTime + deltaTime))
                    {
                        float delta = milestone - prevTime;
                        UpdateCutscene(delta);
                        prevTime = milestone;
                    }
                }
                else
                {
                    UpdateCutscene(deltaTime);
                }
            }
            else
            {
                Pause();
            }
        }
Пример #37
0
 /// <summary>
 /// Set the cutscene into an active state.
 /// </summary>
 public void EnterPreviewMode()
 {
     if (state == CutsceneState.Inactive)
     {
         initialize();
         bake();
         SetRunningTime(RunningTime);
         state = CutsceneState.Paused;
     }
 }
Пример #38
0
        /// <summary>
        /// Preview play readies the cutscene to be played in edit mode. Never use for runtime.
        /// This is necessary for playing the cutscene in edit mode.
        /// </summary>
        public void PreviewPlay()
        {
            if (state == CutsceneState.Inactive)
            {
                EnterPreviewMode();
            }
            else if (state == CutsceneState.Paused)
            {
                resume();
            }

            if (Application.isPlaying)
            {
                state = CutsceneState.Playing;
            }
            else
            {
                state = CutsceneState.PreviewPlaying;
            }
        }
Пример #39
0
 void StartCutscene()
 {
     //utility function to set up start state
     state = CutsceneState.START;
     t = 0.0f;
     t_goal = 1.0f;
 }