DirectionToComponents() public static method

public static DirectionToComponents ( this dir, int &x, int &y ) : void
dir this
x int
y int
return void
Example #1
0
        public static IntVector2 operator +(IntVector2 left, Direction right)
        {
            int x, y;

            DirectionExtensions.DirectionToComponents(right, out x, out y);

            return(new IntVector2(left.X + x, left.Y + y));
        }
Example #2
0
        public static IntVector3 operator +(IntVector3 left, Direction right)
        {
            int x, y, z;

            DirectionExtensions.DirectionToComponents(right, out x, out y, out z);

            return(new IntVector3(left.X + x, left.Y + y, left.Z + z));
        }
Example #3
0
        public static IntVector2 ToIntVector2(this Direction dir)
        {
            Debug.Assert(dir.IsValid());

            int x, y;

            DirectionExtensions.DirectionToComponents(dir, out x, out y);

            return(new IntVector2(x, y));
        }
Example #4
0
        public DoubleVector3(Direction dir)
        {
            int x, y, z;

            DirectionExtensions.DirectionToComponents(dir, out x, out y, out z);

            m_x = x;
            m_y = y;
            m_z = z;
        }
Example #5
0
        /// <summary>
        /// Rotate dir in 45 degree steps
        /// </summary>
        /// <param name="rotate">Rotation units, in 45 degree steps</param>
        public static Direction RotateDir(Direction dir, int rotate)
        {
            int x, y;

            DirectionExtensions.DirectionToComponents(dir, out x, out y);

            IntVector2 v = new IntVector2(x, y);

            v = v.FastRotate(rotate);
            return(v.ToDirection());
        }