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(); }
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(); }
private void OnTriggerReleased() { ChangeStateTo(stateAssigner_.Unassign(this)); }