internal void ClearBreakElements() { if (Area == null) { return; } if (AxisRanges != null) { AxisRanges.Clear(); } if (BreakRanges != null) { BreakRanges.Clear(); } if (dataRanges != null) { dataRanges.Clear(); } BreakRangesInfo.Clear(); if (Area.AdorningCanvas == null) { return; } foreach (var element in BreakShapes) { Area.AdorningCanvas.Children.Remove(element); } BreakShapes.Clear(); }
public ControllerDefinition(ControllerDefinition source) : this() { Name = source.Name; BoolButtons.AddRange(source.BoolButtons); AxisControls.AddRange(source.AxisControls); AxisRanges.AddRange(source.AxisRanges); AxisConstraints.AddRange(source.AxisConstraints); CategoryLabels = source.CategoryLabels; }
public void InitializeRanges() { // Clean up the ranges for (int axisId = 0; axisId < 3; axisId++) { AxisRanges ar = axes[axisId]; // If this axis is unused, mark as zero and move on. if (!this[axisId]) { ar.bits = 0; continue; } if (axes[axisId].limitRange) { if (ar.max < ar.min) { ar.max += 360; } // If the range is greater than 360, get the max down into range. Likely user selected bad min/max values. if (ar.max - ar.min > 360) { ar.max -= 360; } } // use the range as determined by the min/max - unless we are not limiting range, then use 180/360/360 ar.range = ar.limitRange ? ar.max - ar.min : (axisId == 0) ? 180f : 360f; // Get the bits required to transmit the max possible value ar.bits = this[axisId] ? Mathf.Max(0, BitTools.BitsNeeded((uint)(Mathf.CeilToInt(ar.range / ar.res)))) : 0; // Do the heavier division work here so only one multipy per encode/decode is needed ar.mult = (maxValue[ar.bits]) / ar.range; ar.unmult = ar.range / (maxValue[ar.bits]); ar.wrap = ar.range + (360 - ar.range) / 2; } }