public void Update() { var Axis = new Vector2( Mathf.Clamp(Input.GetAxisRaw("Horizontal") + (left + right), -1, 1), Mathf.Clamp(Input.GetAxisRaw("Vertical") + (up + down), -1, 1) ); if (Axis != previousAxis) { UpdateControl?.Invoke(Axis); } previousAxis = Axis; }
/* ----------------------------------------------------------------- */ /// /// OnUpdateControl /// /// <summary> /// Update(object) メソッドを通じてコントロールの内容が更新された /// 時に実行されます。 /// </summary> /// /* ----------------------------------------------------------------- */ protected virtual void OnUpdateControl(KeyValueCancelEventArgs <Control, object> e) { UpdateControl?.Invoke(this, e); if (e.Cancel) { return; } switch (e.Key.GetType().Name) { case nameof(Cube.Forms.ColorButton): UpdateColorButton(e.Key as Cube.Forms.ColorButton, e.Value as Color?); break; case nameof(Cube.Forms.FontButton): UpdateFontButton(e.Key as Cube.Forms.FontButton, e.Value as Font); break; case nameof(System.Windows.Forms.CheckBox): UpdateCheckBox(e.Key as System.Windows.Forms.CheckBox, e.Value as bool?); break; case nameof(System.Windows.Forms.ComboBox): UpdateComboBox(e.Key as System.Windows.Forms.ComboBox, e.Value as int?); break; case nameof(System.Windows.Forms.NumericUpDown): UpdateNumericUpDown(e.Key as System.Windows.Forms.NumericUpDown, e.Value as int?); break; case nameof(System.Windows.Forms.RadioButton): UpdateRadioButton(e.Key as System.Windows.Forms.RadioButton, e.Value as bool?); break; case nameof(System.Windows.Forms.TextBox): UpdateTextBox(e.Key as System.Windows.Forms.TextBox, e.Value as string); break; default: break; } }