/// <summary> /// Inputを監視する /// </summary> private void Start() { InputAsObservable.GetKeyDown(KeyCode.RightArrow) .Subscribe(moveRightStream.OnNext).AddTo(this); InputAsObservable.GetKeyDown(KeyCode.LeftArrow) .Subscribe(moveLeftStream.OnNext).AddTo(this); InputAsObservable.GetKeyDown(KeyCode.Space) .Subscribe(skillStream.OnNext).AddTo(this); }
void Start() { InputAsObservable.GetKey(KeyCode.Space) .Subscribe(shotStream.OnNext).AddTo(this); InputAsObservable.Axis("Horizontal") .Subscribe(moveHorizontalStream.OnNext).AddTo(this); InputAsObservable.Axis("Vertical") .Subscribe(moveVerticalStream.OnNext).AddTo(this); }
private void InputUpdate() { this.UpdateAsObservable() .Select(_ => new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"))) .Subscribe(v => { _playerControllerView.Move = v.normalized; _playerControllerView.AnimatorMoveSpeed = v.magnitude; }); InputAsObservable.GetButtonDown("Jump").Subscribe(_ => { _gunView.ShotBullet(_gunModel.BulletEntity); }); }