コード例 #1
0
 /// <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--;
     }
 }
コード例 #2
0
ファイル: ZoomBase.cs プロジェクト: ditrytus/marbles
    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);
            }
        });
    }
コード例 #3
0
 /// <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));
 }
コード例 #4
0
        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));
        }
コード例 #5
0
ファイル: AxesRanges.cs プロジェクト: ditrytus/marbles
 public bool Contains(Vector3 vector)
 {
     return(xRange.Contains(vector.x) &&
            yRange.Contains(vector.y) &&
            zRange.Contains(vector.z));
 }
コード例 #6
0
 public bool IsValidTile(Tile tile) => !tile.IsWater && height.Contains(tile.height) && temp.Contains(tile.temp) && humidity.Contains(tile.humidity);
コード例 #7
0
 float CalculateIfInside(float value, float coeff, FloatRange interval)
 {
     return(interval.Contains(value) ? value * coeff : 0.0f);
 }
コード例 #8
0
 public bool CorrectTile(Tile tile) => height.Contains(tile.height) && temp.Contains(tile.temp) && humidity.Contains(tile.humidity);