Пример #1
0
 public static CellIndex operator -(int lhs, CellIndex rhs)
 {
     CellIndex result = new CellIndex(0);
     result.index = lhs - rhs.index;
     result.rangeCheck();
     return result;
 }
Пример #2
0
 public static CellIndex operator -(CellIndex lhs, int rhs)
 {
     CellIndex result = new CellIndex(0);
     result.index = lhs.index - rhs;
     result.rangeCheck();
     return result;
 }
Пример #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;
        }