コード例 #1
0
    // Use this for initialization
    void Start()
    {
        obj          = GameObject.Find("Player_Pack(Clone)");
        passingJudge = gameObject.GetComponent <PassingJudge>();
        GameObject playerController = GameObject.Find("PlayerController");
        var        playerVector     = playerController.GetComponent <PlayerVector>();

        playerRunning = obj.GetComponent <PlayerRunning>();

        player = GameObject.Find("Player_Pack(Clone)/Player");

        var stageController = GameObject.Find("StageController");

        stageMake     = stageController.GetComponent <StageMake>();
        startComplete = stageController.GetComponent <StartComplete>();
        button        = stageController.GetComponent <ButtonStatus>();
        playerStatus  = this.GetComponent <PlayerStatus>();

        passingJudge.PlayerNextVector
        .SkipLatestValueOnSubscribe()
        .Delay(TimeSpan.FromSeconds(0.2f))
        .Subscribe(x => StartCoroutine(CheckNextVector()));

        //this.ObserveEveryValueChanged(_ => passingJudge.ColliderCount)
        //.Where(x => x == stageMake.maxRail - 3)
        //.Subscribe(_ =>
        //{
        //playerStatus.playerStateSubject
        //                            .OnNext(PlayerStatus.PlayerState.Idle);
        //playerStatus.playerStateSubject.OnCompleted();
        //}
        //);
    }
コード例 #2
0
 void Start()
 {
     //TODO あとでやる
     stageController = GameObject.Find("StageController");
     startComplete   = stageController.GetComponent <StartComplete>();
     startComplete.startSubject
     .Where(x => x == 4)
     .Subscribe(_ => StartCoroutine(GetInstance()));
 }
コード例 #3
0
    private void Start()
    {
        var stageController = GameObject.Find("StageController");

        designer      = stageController.GetComponent <Designer>();
        startComplete = stageController.GetComponent <StartComplete>();

        startComplete.startSubject
        .Where(x => x == 1)
        .Subscribe(_ => StartCoroutine(InsPlayerCoroutine()));

        //var Player = InsPlayer();
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        var stageController = GameObject.Find("StageController");

        startComplete = stageController.GetComponent <StartComplete>();

        startComplete.startSubject
        .Where(x => x == 3)
        .Subscribe(_ => StartCoroutine(GetInstance()));

        this.FixedUpdateAsObservable()
        .Where(_ => startComplete.completed.Value == true)
        .Subscribe(_ => CameraMove());
    }
コード例 #5
0
    private void Start()
    {
        var playerController = GameObject.Find("PlayerController");

        playerControll = playerController.GetComponent <PlayerController>();
        designer       = this.GetComponent <Designer>();
        stageMake      = this.GetComponent <StageMake>();
        roadMaker      = this.GetComponent <RoadMaker>();
        startComplete  = this.GetComponent <StartComplete>();
        cellPoint      = stageMake.cellPoint;
        mapData        = designer.mapData;
        maxRail        = stageMake.maxRail;

        Observable.FromCoroutine(FirstCoroutine)
        .SelectMany(SecondCoroutine)
        .SelectMany(ThirdCoroutine)
        .Subscribe(_ => StartCoroutine(ThirdCoroutine()));
    }
コード例 #6
0
    void Start()
    {
        button        = this.GetComponent <ButtonStatus>();
        startComplete = this.GetComponent <StartComplete>();
        buttonStatusesList.Add(button);

        startComplete.startSubject
        .Where(x => x == 2)
        .Subscribe(_ => StartCoroutine(GetInstance()));

        foreach (ButtonStatus status in buttonStatusesList)
        {
            button.pushButton
            .Where(x => x == ButtonStatus.ButtonState.Fire1)
            .ThrottleFirst(TimeSpan.FromSeconds(2))
            .Select(_ => playerStatus.cancelFlag)
            .Where(x => x == true)
            .Subscribe(_ =>
            {
                playerStatus.playerStateSubject.OnNext(PlayerStatus.PlayerState.Attack);
            });

            button.pushButton
            .Where(x => x == ButtonStatus.ButtonState.Jump)
            .ThrottleFirst(TimeSpan.FromSeconds(2.5))
            .Select(_ => playerStatus.cancelFlag)
            .Where(x => x == true)
            .Subscribe(_ =>
            {
                playerStatus.playerStateSubject.OnNext(PlayerStatus.PlayerState.Roll);
            });

            button.pushButton
            .Where(x => x == ButtonStatus.ButtonState.Jump)
            .Select(x => playerStatus.lastFlag)
            .Where(x => x == true)
            .First()
            .Subscribe(_ => SceneManager.LoadScene("Title"));
        }
    }
コード例 #7
0
    private void Start()
    {
        startComplete = this.GetComponent <StartComplete>();
        buttonStatusesList.Add(this);

        this.UpdateAsObservable()
        .Where(_ => startComplete.completed.Value == true)
        .Select(_ => Input.GetAxisRaw("Fire1"))
        .Where(x => x > 0)
        .Subscribe(_ => pushButton.OnNext(ButtonState.Fire1));

        this.UpdateAsObservable()
        .Where(_ => startComplete.completed.Value == true)
        .Select(_ => Input.GetAxisRaw("Jump"))
        .Where(x => x > 0)
        .Subscribe(_ => pushButton.OnNext(ButtonState.Jump));

        this.UpdateAsObservable()
        .Where(_ => startComplete.completed.Value == true)
        .Select(_ => Input.GetAxisRaw("Horizontal"))
        .Where(x => x > 0)
        .Subscribe(_ => pushButton.OnNext(ButtonState.PositiveHorizontal));

        this.UpdateAsObservable()
        .Where(_ => startComplete.completed.Value == true)
        .Select(_ => Input.GetAxisRaw("Horizontal"))
        .Where(x => x < 0)
        .Subscribe(_ => pushButton.OnNext(ButtonState.NegativeHorizontal));

        this.UpdateAsObservable()
        .Where(_ => startComplete.completed.Value == true)
        .Select(_ => Input.GetAxisRaw("Vertical"))
        .Where(x => x > 0)
        .Subscribe(_ => pushButton.OnNext(ButtonState.PositiveVertical));

        this.UpdateAsObservable()
        .Where(_ => startComplete.completed.Value == true)
        .Select(_ => Input.GetAxisRaw("Vertical"))
        .Where(x => x < 0)
        .Subscribe(_ => pushButton.OnNext(ButtonState.NegativeVertical));


        ///TODO
        /// 実装予定

        //foreach (ButtonStatus buttonStatus in buttonStatusesList)
        //{
        //    pushButton.Where(x => x == ButtonState.PositiveHorizontal)
        //              .Select(_ => Input.GetAxisRaw("Jump"))
        //              //.TimeoutFrame(3)
        //              //.DoOnError(x => Debug.Log(x))
        //              //.OnErrorRetry((TimeoutException ex)
        //                            //=> pushButton.OnNext(ButtonState.Non))
        //              .Where(x => x > 0)
        //              .Subscribe(_ => pushButton.OnNext(ButtonState.PositiveJump));

        //    pushButton.Where(x => x == ButtonState.NegativeHorizontal)
        //              .Select(_ => Input.GetAxisRaw("Jump"))
        //              .Where(x => x > 0)
        //              .Subscribe(_ => pushButton.OnNext(ButtonState.NegativeJump));
        //}


        ///<summary>
        /// TODO
        /// 過去スクリプト
        /// </summary>
        //this.UpdateAsObservable()
        //.Where(_ => Input.GetKey(KeyCode.RightArrow) && Input.GetKeyDown(KeyCode.S))
        //.Subscribe(_ => rightStep.Value = true);

        //this.UpdateAsObservable()
        //	 .Where(_ => Input.GetKey(KeyCode.LeftArrow) && Input.GetKeyDown(KeyCode.S))
        //                    .Subscribe(_ => leftStep.Value = true);

        //this.UpdateAsObservable()
        //	.Where(_ => Input.GetKeyDown(KeyCode.Space))
        //				.Subscribe(_ => roll.Value = true);

        //this.UpdateAsObservable()
        //	.Where(_ => Input.GetKeyDown(KeyCode.UpArrow))
        //    .Subscribe(_ => up.Value = true);

        //this.UpdateAsObservable()
        //          .Where(_ => Input.GetKeyUp(KeyCode.UpArrow))
        //               .Subscribe(_ => up.Value = false);

        //this.UpdateAsObservable()
        //	.Where(_ => Input.GetKeyDown(KeyCode.RightArrow))
        //    .Subscribe(_ => right.Value = true);

        //this.UpdateAsObservable()
        //          .Where(_ => Input.GetKeyUp(KeyCode.RightArrow))
        //                  .Subscribe(_ => right.Value = false);

        //this.UpdateAsObservable()
        //    .Where(_ => Input.GetKeyDown(KeyCode.LeftArrow))
        //    .Subscribe(_ => left.Value = true);

        //this.UpdateAsObservable()
        //                .Where(_ => Input.GetKeyUp(KeyCode.LeftArrow))
        //                .Subscribe(_ => left.Value = false);

        //this.UpdateAsObservable()
        //          .Where(_ => Input.GetKeyDown(KeyCode.DownArrow))
        //    .Subscribe(_ => down.Value = true);

        //this.UpdateAsObservable()
        //.Where(_ => Input.GetKeyUp(KeyCode.DownArrow))
        //.Subscribe(_ => down.Value = false);
    }