示例#1
0
        protected IEnumerator GoToNextPage()
        {
            HighlightColor.a = 0f;
            while (HighlightColor.a > 0f)                                       //wait for the highlight to run down first
            {
                HighlightColor.a = Mathf.Lerp(HighlightColor.a, 0f, (float)(HighlightSpeed * Frontiers.WorldClock.ARTDeltaTime));
                if (HighlightColor.a < 0.001f)                                                          //snap to zero so we're not waiting forever
                {
                    HighlightColor.a = 0f;
                }
            }

            ////Debug.Log ("Going to next page");
            CurrentPageIndex++;
            if (CurrentPageIndex < LetterPages.Count)
            {
                CurrentPage = LetterPages[CurrentPageIndex];
                CurrentPage.LastCharDisplayed = -1;
                CurrentPage.Refresh(Creator.Character);
                WaitForNextPage = true;
                LetterWriter.WaitForNextPage();
                //wait for player to confirm they want to move forward
                while (WaitForNextPage)
                {
                    yield return(null);
                }
            }
            else
            {
                FinishedWriting            = true;
                LetterWriter.WritingLetter = false;
                OnCharacterCreated();
            }
            yield break;
        }
示例#2
0
        public IEnumerator WriteLetter()
        {
            CurrentPageIndex = 0;
            CurrentPage      = LetterPages[CurrentPageIndex];

            while (!FinishedWriting)
            {
                if (LetterWriter.QuickCreateMode)
                {
                    //wait for quick create to finish
                    yield return(null);
                }
                else
                {
                    //otherwise write the letter
                    if (mHasMadeOneChoice && WorldClock.RealTime > mNextSoundPlayTime)
                    {
                        MasterAudio.PlaySound(SoundType, WritingSounds[UnityEngine.Random.Range(0, WritingSounds.Count)]);
                        mNextSoundPlayTime = WorldClock.RealTime + 1.0;
                    }
                    HighlightColor.a = Mathf.Lerp(HighlightColor.a, 0f, (float)(HighlightSpeed * Frontiers.WorldClock.ARTDeltaTime));
                    if (HighlightColor.a < 0.001f)                                                                      //snap to zero so we're not waiting forever
                    {
                        HighlightColor.a = 0f;
                    }

                    CurrentPage.Refresh(Creator.Character);
                    bool newAction = false;
                    for (int i = 0; i < NumCharactersPerFrame * WorldClock.RTDeltaTime; i++)
                    {
                        if (CurrentPage.GoToNextChar(out CurrentAction))
                        {
                            //do we need to do this? have we created the character already?
                            newAction = true;
                            MasterAudio.StopAllOfSound(MasterAudio.SoundType.PlayerInterface);
                            mNextSoundPlayTime = 0;
                            break;
                        }
                    }

                    if (newAction)                                                              ////Debug.Log ("Going to next action");
                    //if we have a new action to wait for
                    //update the page first
                    {
                        LetterTextLabel.text = CurrentPage.DisplayText;
                        Size.FitToWidth(MaxWidth);
                        //then dispatch the action and wait for a result
                        yield return(StartCoroutine(WaitForCurrentAction()));
                    }
                    else if (LetterWriter.SkipToNextChoice)                                                                 //if the player wants to skip ahead
                    //Debug.Log ("PROLOGUE LETTER: Skipping to next choice...");
                    {
                        LetterWriter.SkipToNextChoice = false;
                        if (CurrentPage.GoToNextChoice(out CurrentAction))
                        {
                            //if we have a new action on this page
                            //update the page
                            //then wait for current action
                            LetterTextLabel.text = CurrentPage.DisplayText;
                            Size.FitToWidth(MaxWidth);
                            yield return(StartCoroutine(WaitForCurrentAction()));
                        }
                        else                                                                             //otherwise go to the next page
                        {
                            yield return(StartCoroutine(GoToNextPage()));
                        }
                    }
                    else                                                                        //otherwise just update the page and wait the time alotted
                    {
                        LetterTextLabel.text = CurrentPage.DisplayText;
                        Size.FitToWidth(MaxWidth);
                        yield return(null);
                    }

                    if (CurrentPage.GoToNextPage)                                                               ////Debug.Log ("Time to go to next page");
                    {
                        yield return(StartCoroutine(GoToNextPage()));
                    }
                    yield return(null);
                }
            }
            yield break;
        }