コード例 #1
0
    public override void Start()
    {
        base.Start();

        _state      = State.Beginning;
        _dialogList = new List <GameObject>();

        _characterData = playerData.GetRandomCharacter();
        beginningDialog.ApplyCharacter(_characterData);
        beginningDialog.Display(playerData, _characterData);
        bobController.GetComponent <Rigidbody2D>().isKinematic = true;
    }
コード例 #2
0
    public void OnInteract()
    {
        Result result;

        switch (_state)
        {
        case State.Beginning:
            result = beginningDialog.Display(playerData, _characterData);

            if (result.isDone)
            {
                _inputGenerationCoroutine = InputGenerationCoroutine();
                _state = State.Gameplay;

                StartCoroutine(_inputGenerationCoroutine);
                StartCoroutine(GameplayTimer());
            }
            break;

        case State.Gameplay:
            break;

        case State.Result:
            result = _currentDialog.Display(playerData, _characterData);

            if (result.isDone)
            {
                SceneManager.LoadScene("Ending");
            }
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
コード例 #3
0
    IEnumerator GameplayTimer()
    {
        _startTime = Time.time;
        yield return(new WaitForSeconds(gameplayDuration));

        if (_inputGenerationCoroutine != null)
        {
            StopCoroutine(_inputGenerationCoroutine);
        }

        foreach (Transform child in transform)
        {
            CodingBug script = child.GetComponent <CodingBug>();

            if (script != null)
            {
                script.enabled = false;
            }
        }

        _state = State.Result;
        playerAvatar.Freeze();
        playerData.SetBugLeft(transform.childCount);

        _currentDialog = resultDialog;
        _currentDialog.ApplyCharacter(_characterData);
        _currentDialog.Display(playerData, _characterData);
    }
コード例 #4
0
    private void Update()
    {
        if (_state == State.Gameplay && _beatMap.IsReady())
        {
            if (_beatMap.IsDone())
            {
                _state = State.Result;
                playerData.SetMusicGrade(gradeList);
                _audioManager.TryPlay();

                _currentDialog = resultDialog;
                _currentDialog.ApplyCharacter(_characterData);
                _currentDialog.Display(playerData, _characterData);
                return;
            }

            BeatObject beatObject = _beatMap.RequestDrawableBeat();
            if (beatObject != null)
            {
                BeatRenderer beatRenderer = Instantiate(prefabBeat).GetComponent <BeatRenderer>();
                beatRenderer.SetData(beatObject, _beatMap);
                beatRenderer.Init();
            }

            BeatObjectGrade grade = _beatMap.React(false);

            if (grade == BeatObjectGrade.Miss)
            {
                gradeList.Add(grade);
                badAudio.Play();
                Instantiate(prefabMiss);
            }
        }
    }
コード例 #5
0
    IEnumerator ShowDialogList()
    {
        for (var i = 0; i < _generatedList.Count; i++)
        {
            GameObject dialogItem = Instantiate(prefabDialogItem, dialogHolder.parent);
            dialogItem.transform.SetParent(dialogHolder);
            ScopeDialogItem script = dialogItem.GetComponent <ScopeDialogItem>();
            script.SetData(playerData.GetRandomCharacter(), _generatedList[i].sentences);
            _dialogList.Add(dialogItem);

            if (_dialogList.Count > dialogCountLimit)
            {
                Destroy(_dialogList[0]);
                _dialogList.RemoveAt(0);
            }

            yield return(new WaitForSeconds(dialogListDelay));
        }
        yield return(new WaitForSeconds(dialogListDelay * 2));

        _state = State.Result;

        characterData  = playerData.GetRandomCharacter();
        _currentDialog = resultDialog;
        _currentDialog.ApplyCharacter(characterData);
        _currentDialog.Display(playerData, characterData);
    }
コード例 #6
0
    public void OnInteract()
    {
        Result result;

        switch (_state)
        {
        case State.Beginning:
            result = beginningDialog.Display(playerData, characterData);

            if (result.isDone)
            {
                _state = State.Gameplay;
                StartCoroutine(ShowPictureCoroutine());
            }
            break;

        case State.Gameplay:
            break;

        case State.Result:
            result = _currentDialog.Display(playerData, characterData);

            if (result.isDone)
            {
                SceneManager.LoadScene("Recruitment");
            }
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
コード例 #7
0
            protected override Result BodyTryUsing(PlayerData playerData, CodingMamaCharacter characterData)
            {
                DialogGroup currentDialog = defaultLine;

                switch (state)
                {
                case State.Introduction:
                    currentDialog = introduction;
                    break;
                }

                Result result = currentDialog.Display(playerData, characterData);

                lastQuestion = result.yesOrNoQuestion;

                if (result.isDone)
                {
                    playerData.dialogManager.Hide();

                    switch (state)
                    {
                    case State.Accepted:
                    case State.Introduction:
                        state = State.DefaultLine;
                        break;

                    default:
                        defaultLine.RestartValue();
                        break;
                    }
                }

                return(result);
            }
コード例 #8
0
 public override void Start()
 {
     base.Start();
     playerData.Restart();
     _state         = State.Beginning;
     _currentDialog = beginningDialog;
     _currentDialog.ApplyCharacter(characterData);
     _currentDialog.Display(playerData, characterData);
 }
コード例 #9
0
    IEnumerator ShowPictureCoroutine()
    {
        GameObject theme = Instantiate(prefabTheme, canvas.transform, true);

        yield return(new WaitForSeconds(themeShowDuration));

        _state         = State.Result;
        _currentDialog = resultDialog;
        _currentDialog.ApplyCharacter(characterData);
        _currentDialog.Display(playerData, characterData);
    }
コード例 #10
0
    public override void Start()
    {
        base.Start();

        _genDuration = maxGenDuration;
        _state       = State.Beginning;

        _characterData = playerData.GetRandomCharacter();
        _currentDialog = beginningDialog;
        _currentDialog.ApplyCharacter(_characterData);
        _currentDialog.Display(playerData, _characterData);
    }
コード例 #11
0
    private void DisplayResult()
    {
        float scopeResult = bobController.transform.position.y;

        playerData.SetScopeResult(scopeResult);

        _resultDialog = scopeResult > 0 ? overScopeDialog : underScopeDialog;

        _characterData = playerData.GetRandomCharacter();
        _resultDialog.ApplyCharacter(_characterData);
        _resultDialog.Display(playerData, _characterData);
    }
コード例 #12
0
    public override void Start()
    {
        base.Start();

        _state        = State.Beginning;
        _invLerpValue = 1f;
        _lerpValue    = 0f;

        _characterData = playerData.GetRandomCharacter();
        _currentDialog = beginningDialog;
        _currentDialog.ApplyCharacter(_characterData);
        _currentDialog.Display(playerData, _characterData);
    }
コード例 #13
0
    public override void Start()
    {
        base.Start();
        StartCoroutine(GenerateDialogList());
        _dialogList = new List <GameObject>();
        _state      = State.Beginning;


        characterData  = playerData.GetRandomCharacter();
        _currentDialog = beginningDialog;
        _currentDialog.ApplyCharacter(characterData);
        _currentDialog.Display(playerData, characterData);
    }
コード例 #14
0
    IEnumerator GameplayTimer()
    {
        _startTime = Time.time;
        yield return(new WaitForSeconds(gameplayDuration));

        _state = State.Result;
        playerAvatar.Freeze();

        playerData.SetArtScore(_goodScore, _badScore);

        _currentDialog = resultDialog;
        _currentDialog.ApplyCharacter(_characterData);
        _currentDialog.Display(playerData, _characterData);
    }
コード例 #15
0
    public override void Start()
    {
        base.Start();

        gradeList = new List <BeatObjectGrade>();

        _audioManager = AudioManager.GetInstance();
        _beatMap      = beatMapData.GenerateBeatMap();
        _state        = State.Beginning;

        _audioSource      = GetComponent <AudioSource>();
        _audioSource.clip = beatMapData.GetAudioClip();

        _characterData = playerData.GetRandomCharacter();
        _currentDialog = beginningDialog;
        _currentDialog.ApplyCharacter(_characterData);
        _currentDialog.Display(playerData, _characterData);
    }
コード例 #16
0
    public void OnInteract()
    {
        Result result;

        switch (_state)
        {
        case State.Beginning:
            result = beginningDialog.Display(playerData, _characterData);

            if (result.isDone)
            {
                _inputGenerationCoroutine = InputGenerationCoroutine();
                _state = State.Gameplay;

                StartCoroutine(_inputGenerationCoroutine);
                StartCoroutine(GameplayTimer());
                bobController.GetComponent <Rigidbody2D>().isKinematic = false;
            }
            break;

        case State.Gameplay:
            bobController.OnInteract();
            break;

        case State.Result:
            result = _resultDialog.Display(playerData, _characterData);

            if (result.isDone)
            {
                SceneManager.LoadScene("Music");
            }
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
コード例 #17
0
    public void OnInteract()
    {
        Result result;

        switch (_state)
        {
        case State.Beginning:
            result = beginningDialog.Display(playerData, _characterData);

            if (result.isDone)
            {
                _state = State.Gameplay;
                _audioManager.TryPause();
                StartCoroutine(StarDelay());
            }
            break;

        case State.Gameplay:
            if (_beatMap.IsReady())
            {
                BeatObjectGrade grade = _beatMap.React(true);
                gradeList.Add(grade);

                switch (grade)
                {
                case BeatObjectGrade.Waiting:
                    break;

                case BeatObjectGrade.Excellent:
                    Instantiate(prefabExcellent);
                    goodAudio.Play();
                    break;

                case BeatObjectGrade.Good:
                    Instantiate(prefabGreat);
                    goodAudio.Play();
                    break;

                case BeatObjectGrade.Okay:
                    Instantiate(prefabGood);
                    goodAudio.Play();
                    break;

                case BeatObjectGrade.Miss:
                    break;

                case BeatObjectGrade.Inactive:
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            break;

        case State.Result:
            result = _currentDialog.Display(playerData, _characterData);

            if (result.isDone)
            {
                SceneManager.LoadScene("Art");
            }
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }