Ejemplo n.º 1
0
 public static CellIndex operator -(int lhs, CellIndex rhs)
 {
     CellIndex result = new CellIndex(0);
     result.index = lhs - rhs.index;
     result.rangeCheck();
     return result;
 }
Ejemplo n.º 2
0
 public static CellIndex operator -(CellIndex lhs, int rhs)
 {
     CellIndex result = new CellIndex(0);
     result.index = lhs.index - rhs;
     result.rangeCheck();
     return result;
 }
Ejemplo n.º 3
0
        public static CellIndex fromAngle(float degrees)
        {
            CellIndex result = new CellIndex(0);
            // Allow values near 360 to round down to 0
            degrees += 30.0f;
            // Scale and quantise to index
            result.index = Mathf.FloorToInt(degrees / 60.0f);
            if (result.index > 5) result.index -= 6;

            result.rangeCheck();
            return result;
        }