Ejemplo n.º 1
0
 public string Report()
 {
     return(_x + "," + _y + "," + _facing.ToString());
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Convert facing direction to angle (radians).
        /// </summary>
        /// <param name="facingDirection">Facing direction to convert</param>
        /// <returns>Angle in radians</returns>
        private static float AngleFromFacingDirection(FacingDirections facingDirection)
        {
            switch (facingDirection)
            {
            case FacingDirections.N:
                return(4.71238898f);

            case FacingDirections.Ne:
                return(5.49778714f);

            case FacingDirections.E:
                return(0.0f);

            case FacingDirections.Se:
                return(0.785398163f);

            case FacingDirections.S:
                return(1.57079633f);

            case FacingDirections.Sw:
                return(2.35619449f);

            case FacingDirections.W:
                return(3.14159265f);

            case FacingDirections.Nw:
                return(3.92699082f);
            }
            throw new Exception("Could not calculate direction from facing directin: " + facingDirection.ToString());
        }