/// <summary> /// CTOR of Steering. /// </summary> public Steering() { InitializeComponent(); SteeringModel.CreateModel(); vm = new SteeringViewModel(SteeringModel.Instance); this.DataContext = vm; }
/** * Listen to input. Update model. Get position from steering and speed. * * http://answers.unity3d.com/questions/27369/how-to-move-an-object-from-point-a-to-point-b-with.html * http://docs.unity3d.com/ScriptReference/Input.GetKeyDown.html */ private void UpdateInput(SteeringModel steering) { steering.isInputLeft = Input.GetKeyDown(KeyCode.LeftArrow); steering.isInputRight = Input.GetKeyDown(KeyCode.RightArrow); steering.isVerbose = isVerbose; if (isVerbose) { if (model.steering.isInputLeft) { Debug.Log("PlayerController.Update: Left"); } if (model.steering.isInputRight) { Debug.Log("PlayerController.Update: Right"); } } }