예제 #1
0
    private IEnumerator ProcessStory()
    {
        if (_storyFeed.Title != null)
        {
            LeanTween.value(_storyFeed.Title.gameObject, val =>
            {
                Color color            = _storyFeed.Title.color;
                color.a                = val;
                _storyFeed.Title.color = color;
            }, 0.0f, 1.0f, _storyFeed.TitleFadeInTime);

            yield return(new WaitForSeconds(_storyFeed.TitleFadeInTime + _storyFeed.TitleShowTime));

            while (Input.GetMouseButtonDown(0) == false)
            {
                yield return(null);
            }

            LeanTween.value(_storyFeed.Title.gameObject, val =>
            {
                Color color            = _storyFeed.Title.color;
                color.a                = val;
                _storyFeed.Title.color = color;
            }, 1.0f, 0.0f, _storyFeed.TitleFadeOutTime);

            yield return(new WaitForSeconds(_storyFeed.TitleFadeOutTime));
        }

        while (_inkStory.canContinue)
        {
            string inkLine = _inkStory.Continue();

            while (_delayBeforeNextLine > 0.0f)
            {
                _delayBeforeNextLine -= Time.deltaTime;
                if (_delayBeforeNextLine < 0.0f)
                {
                    _delayBeforeNextLine = 0.0f;
                }

                yield return(null);

                if (Application.isEditor && Input.GetMouseButtonDown(1))
                {
                    _delayBeforeNextLine = 0.0f;
                }
            }

            if (!ParseAction(inkLine))
            {
                float delayTime;
                inkLine = ParseDisplayTime(inkLine, out delayTime);

                delayTime = delayTime < 0.0f ? 2.0f : delayTime;

                _storyFeed.DisplayLine(inkLine, _firstAfterChoice ? StoryFeed.Side.Right : StoryFeed.Side.Left);
                _firstAfterChoice = false;

                while (_storyFeed.DisplayingLine)
                {
                    yield return(null);
                }

                float timer = 0.0f;
                while (timer < delayTime)
                {
                    timer += Time.deltaTime;

                    yield return(null);

                    if (Input.GetMouseButtonDown(0))
                    {
                        break;
                    }
                }
            }

            if (_inkStory.canContinue == false)
            {
                DisplayCurrentInkChoices();

                while (_inkStory.canContinue == false && _inkStory.currentChoices.Count > 0)
                {
                    yield return(null);
                }
            }
        }

        while (Input.GetMouseButtonDown(0) == false)
        {
            yield return(null);
        }

        SceneManager.LoadScene("Master Scene");
    }
예제 #2
0
    private IEnumerator PlaySceneCoroutine(StoryScene scene, float initialDelay = 0.0f)
    {
        CurrentScene = scene;
        // _storyOptionBox.ClearOptions();
        _storyFeed.ClearOptions();

        if (string.IsNullOrEmpty(scene.Data.Name) == false)
        {
            _storyFeed.Clear();
            yield return(StartCoroutine(_storyFeed.DisplaySceneName(scene)));
        }

        _inkStory.ChoosePathString(scene.Data.Key);

        {
            float timer = 0.0f;
            while (timer < initialDelay)
            {
                timer += Time.deltaTime;

                yield return(null);

                if ((StoryManager.Instance.GameplayTextMode == GameplayTextMode.ClickToContinue && Input.GetMouseButtonDown(0)) ||
#if MULTI_TOUCH_SKIP
                    (Input.touchCount > 1 && Input.GetTouch(1).phase == TouchPhase.Began) ||
#endif
                    (Application.isEditor && Input.GetMouseButtonDown(1)))
                {
                    break;
                }
            }
        }

        while (_inkStory.canContinue)
        {
            string inkLine = _inkStory.Continue();

            if (!ParseAction(scene, inkLine))
            {
                float delayTime;
                inkLine = ParseDisplayTime(inkLine, out delayTime);

                delayTime = delayTime < 0.0f ? StoryManager.Instance.DefaultEndDelay : delayTime;

                _storyFeed.DisplayLine(inkLine);

                while (_storyFeed.DisplayingLine)
                {
                    yield return(null);
                }

                float timer = 0.0f;
                while (timer < delayTime)
                {
                    timer += Time.deltaTime;

                    yield return(null);

                    if ((StoryManager.Instance.GameplayTextMode == GameplayTextMode.ClickToContinue && Input.GetMouseButtonDown(0)) ||
#if MULTI_TOUCH_SKIP
                        (Input.touchCount > 1 && Input.GetTouch(1).phase == TouchPhase.Began) ||
#endif
                        (Application.isEditor && Input.GetMouseButtonDown(1)))
                    {
                        break;
                    }
                }
            }

            while (Syncing)
            {
                yield return(null);
            }

            if (_inkStory.canContinue == false)
            {
                DisplayCurrentInkChoices();

                while (_inkStory.canContinue == false && _inkStory.currentChoices.Count > 0)
                {
                    yield return(null);
                }
            }
        }

        PlayNextScene();
    }