/// <summary> /// Calculates the current rotation the control is at. /// </summary> protected virtual void CalculateRotationMultiplier() { if (circleUpperLeftQuadrant.Contains(PreviousActualAngle) && circleUpperRightQuadrant.Contains(CurrentActualAngle)) { rotationMultiplier++; } else if (circleUpperRightQuadrant.Contains(PreviousActualAngle) && circleUpperLeftQuadrant.Contains(CurrentActualAngle)) { rotationMultiplier--; } }
protected void ZoomCameraInCenter(float zoomDelta, Vector3 zoomCenter) { zoomCameras.ForEach(cam => { var oldWorldPos = cam.ScreenToWorldPoint(zoomCenter); var newSize = cam.orthographicSize + zoomDelta * zoomSpeed; if (sizeRange.Contains(newSize)) { cam.orthographicSize = newSize; var newWorldPos = cam.WorldToScreenPoint(oldWorldPos); pan.Pan(zoomCenter - newWorldPos); } }); }
/// <summary> /// Transforms the given input float to the equivalent bool value. /// </summary> /// <param name="input">The value to transform.</param> /// <returns>The transformed value.</returns> protected override bool Process(float input) { return(positiveBounds.Contains(input)); }
public void Contains() { FloatRange range = new FloatRange(0.3f, 0.8f); Assert.IsFalse(range.Contains(0f)); Assert.IsFalse(range.Contains(1f)); Assert.IsTrue(range.Contains(0.3f)); Assert.IsTrue(range.Contains(0.5f)); Assert.IsTrue(range.Contains(0.8f)); range.minimum = 1f; range.maximum = 2f; Assert.IsFalse(range.Contains(0.3f)); Assert.IsFalse(range.Contains(0.5f)); Assert.IsFalse(range.Contains(0.8f)); Assert.IsTrue(range.Contains(1f)); Assert.IsTrue(range.Contains(1.5f)); Assert.IsTrue(range.Contains(2f)); range.minimum = 2f; range.maximum = 1f; Assert.IsFalse(range.Contains(1f)); Assert.IsFalse(range.Contains(1.5f)); Assert.IsFalse(range.Contains(2f)); range.minimum = -2f; range.maximum = -1f; Assert.IsTrue(range.Contains(-1f)); Assert.IsTrue(range.Contains(-1.5f)); Assert.IsTrue(range.Contains(-2f)); }
public bool Contains(Vector3 vector) { return(xRange.Contains(vector.x) && yRange.Contains(vector.y) && zRange.Contains(vector.z)); }
public bool IsValidTile(Tile tile) => !tile.IsWater && height.Contains(tile.height) && temp.Contains(tile.temp) && humidity.Contains(tile.humidity);
float CalculateIfInside(float value, float coeff, FloatRange interval) { return(interval.Contains(value) ? value * coeff : 0.0f); }
public bool CorrectTile(Tile tile) => height.Contains(tile.height) && temp.Contains(tile.temp) && humidity.Contains(tile.humidity);