Exemple #1
0
    private void Start()
    {
        // 走行アニメーションを再生する
        BeginStream.Subscribe(_ => _animator.Play("Run"));

        // チュートリアルの文言を変更する
        BeginStream.Subscribe(_ => _tutorialText.text = "左クリックで待機ステートに遷移します");

        // 左クリックされたら待機ステートに遷移する
        UpdateStream.Where(_ => Input.GetMouseButtonDown(0))
        .Subscribe(_ => Transition <IdleState>());
    }
Exemple #2
0
    private void Start()
    {
        // Play the running animation
        BeginStream.Subscribe(_ => _animator.Play("Run"));

        // Change the language of the tutorial
        BeginStream.Subscribe(_ => _tutorialText.text = "Transit to wait state with left click");

        // Transit to wait state when left clicked
        UpdateStream.Where(_ => Input.GetMouseButtonDown(0))
        .Subscribe(_ => Transition <IdleState>());
    }
Exemple #3
0
    private void Start()
    {
        // アピールアニメーションを再生する
        BeginStream.Subscribe(_ => _animator.Play("Appeal"));

        // チュートリアルの文言を変更する
        BeginStream.Subscribe(_ => _tutorialText.text = (int)IdleState.TRANSITION_TO_APPEAL_DURATION + "秒経過したのでアピールステートに遷移しました");

        // アピールアニメーションの再生が完了したら待機ステートに遷移する
        UpdateStream.Where(_ => _animator.IsCompleted(Animator.StringToHash("Appeal")))
        .Subscribe(_ => Transition <IdleState>());

        // 右クリックされたら走行ステートに遷移する
        UpdateStream.Where(_ => Input.GetMouseButtonDown(0))
        .Subscribe(_ => Transition <RunState>());
    }
Exemple #4
0
    private void Start()
    {
        // Play appeal animation
        BeginStream.Subscribe(_ => _animator.Play("Appeal"));

        // Change the language of the tutorial
        BeginStream.Subscribe(_ => _tutorialText.text =
                                  (int)IdleState.TRANSITION_TO_APPEAL_DURATION + "It has transitioned to the appeal state because seconds have passed");

        // Transition to the standby state when the play of the appeal animation is completed
        UpdateStream.Where(_ => _animator.IsCompleted(Animator.StringToHash("Appeal")))
        .Subscribe(_ => Transition <IdleState>());

        // Transit to driving state when left-clicked
        UpdateStream.Where(_ => Input.GetMouseButtonDown(0))
        .Subscribe(_ => Transition <RunState>());
    }
Exemple #5
0
    private void Start()
    {
        // 待機アニメーションを再生する
        BeginStream.Subscribe(_ => _animator.Play("Idle"));

        // チュートリアルの文言を変更する
        BeginStream.Subscribe(_ => _tutorialText.text = "左クリックで走行ステートに遷移します");


        float counter = 0f;

        // n秒経過したらアピールステートに遷移する
        UpdateStream.Do(_ => counter += Time.deltaTime)
        .Where(count => counter > TRANSITION_TO_APPEAL_DURATION)
        .Subscribe(_ => Transition <AppealState>());

        // 左クリックされたら走行ステートに遷移する
        UpdateStream.Where(_ => Input.GetMouseButtonDown(0))
        .Subscribe(_ => Transition <RunState>());

        // ステート遷移を行うときカウンタをリセットする
        EndStream.Subscribe(_ => counter = 0f);
    }
Exemple #6
0
    private void Start()
    {
        // Play idle animation
        BeginStream.Subscribe(_ => _animator.Play("Idle"));

        // Change the language of the tutorial
        BeginStream.Subscribe(_ => _tutorialText.text = "Transit to driving state with left click");


        float counter = 0f;

        // Transit to appeal state after n seconds
        UpdateStream.Do(_ => counter += Time.deltaTime)
        .Where(count => counter > TRANSITION_TO_APPEAL_DURATION)
        .Subscribe(_ => Transition <AppealState>());

        // Transit to driving state when left-clicked
        UpdateStream.Where(_ => Input.GetMouseButtonDown(0))
        .Subscribe(_ => Transition <RunState>());

        // Reset counter when performing state transition
        EndStream.Subscribe(_ => counter = 0f);
    }