コード例 #1
0
        public void Construction()
        {
            stateAssignerMock_.Unassign(Arg.Any <object>()).Returns(idleControllerStateMock_);

            var unused = new Controller(stateAssignerMock_, controllerBehaviourMock_);

            stateAssignerMock_.Received(1).Unassign(Arg.Any <object>());
            idleControllerStateMock_.Received(1).OnStateSelected();
        }
コード例 #2
0
        public Controller(IStateAssigner stateAssigner, IControllerBehaviour controllerBehaviour)
        {
            stateAssigner_       = stateAssigner;
            controllerBehaviour_ = controllerBehaviour;

            controllerBehaviour_.TransformChanged          += OnTransformChanged;
            controllerBehaviour_.TriggerPressed            += OnTriggerPressed;
            controllerBehaviour_.TriggerReleased           += OnTriggerReleased;
            controllerBehaviour_.ThumbstickPositionChanged += OnThumbStickPositionChanged;

            controllerBehaviour_.Updated += OnUpdated;

            currentState_ = stateAssigner_.Unassign(this);
            currentState_.OnStateSelected();
        }
コード例 #3
0
 private void OnTriggerReleased()
 {
     ChangeStateTo(stateAssigner_.Unassign(this));
 }