コード例 #1
0
        public void BindInputController(IUIInput controller)
        {
            m_UserInput.Shoot.DownTrigger
            .OnPointerDownAsObservable()
            .Subscribe(_ => m_Shoot.Value = true);
            m_UserInput.Shoot.UpTrigger
            .OnPointerUpAsObservable()
            .Subscribe(_ => m_Shoot.Value = false);
            m_UserInput.Left.DownTrigger
            .OnPointerDownAsObservable()
            .Subscribe(_ => m_Move.Value = -1f);
            m_UserInput.Left.UpTrigger
            .OnPointerUpAsObservable()
            .Where(_ => m_Move.Value == -1f)
            .Subscribe(_ => m_Move.Value = 0f);
            m_UserInput.Right.DownTrigger
            .OnPointerDownAsObservable()
            .Subscribe(_ => m_Move.Value = 1f);
            m_UserInput.Right.UpTrigger
            .OnPointerUpAsObservable()
            .Where(_ => m_Move.Value == 1f)
            .Subscribe(_ => m_Move.Value = 0f);

            controller.SetUIMovementProperty(m_Move);
            controller.SetUIShootProperty(m_Shoot);
        }