/// <summary>
        /// Get edge of map the pawn is closest too
        /// </summary>
        /// <param name="pawn"></param>
        /// <param name="map"></param>
        /// <returns></returns>
        public static Rot4 ClosestEdge(Pawn pawn, Map map)
        {
            IntVec2 mapSize  = new IntVec2(map.Size.x, map.Size.z);
            IntVec2 position = new IntVec2(pawn.Position.x, pawn.Position.z);

            SPTuples.SPTuple2 <Rot4, int> hDistance = Math.Abs(position.x) < Math.Abs(position.x - mapSize.x) ? new SPTuples.SPTuple2 <Rot4, int>(Rot4.West, position.x) : new SPTuples.SPTuple2 <Rot4, int>(Rot4.East, Math.Abs(position.x - mapSize.x));
            SPTuples.SPTuple2 <Rot4, int> vDistance = Math.Abs(position.z) < Math.Abs(position.z - mapSize.z) ? new SPTuples.SPTuple2 <Rot4, int>(Rot4.South, position.z) : new SPTuples.SPTuple2 <Rot4, int>(Rot4.North, Math.Abs(position.z - mapSize.z));

            return(hDistance.Second <= vDistance.Second ? hDistance.First : vDistance.First);
        }
        /// <summary>
        /// Draw selection brackets for pawn with angle
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="bracketLocs"></param>
        /// <param name="obj"></param>
        /// <param name="worldPos"></param>
        /// <param name="worldSize"></param>
        /// <param name="dict"></param>
        /// <param name="textureSize"></param>
        /// <param name="pawnAngle"></param>
        /// <param name="jumpDistanceFactor"></param>
        public static void CalculateSelectionBracketPositionsWorldForMultiCellPawns <T>(Vector3[] bracketLocs, T obj, Vector3 worldPos, Vector2 worldSize, Dictionary <T, float> dict, Vector2 textureSize, float pawnAngle = 0f, float jumpDistanceFactor = 1f)
        {
            float num;
            float num2;

            if (!dict.TryGetValue(obj, out num))
            {
                num2 = 1f;
            }
            else
            {
                num2 = Mathf.Max(0f, 1f - (Time.realtimeSinceStartup - num) / 0.07f);
            }
            float num3 = num2 * 0.2f * jumpDistanceFactor;
            float num4 = 0.5f * (worldSize.x - textureSize.x) + num3;
            float num5 = 0.5f * (worldSize.y - textureSize.y) + num3;
            float y    = AltitudeLayer.MetaOverlays.AltitudeFor();

            bracketLocs[0] = new Vector3(worldPos.x - num4, y, worldPos.z - num5);
            bracketLocs[1] = new Vector3(worldPos.x + num4, y, worldPos.z - num5);
            bracketLocs[2] = new Vector3(worldPos.x + num4, y, worldPos.z + num5);
            bracketLocs[3] = new Vector3(worldPos.x - num4, y, worldPos.z + num5);

            switch (pawnAngle)
            {
            case 45f:
                for (int i = 0; i < 4; i++)
                {
                    float xPos = bracketLocs[i].x - worldPos.x;
                    float yPos = bracketLocs[i].z - worldPos.z;
                    SPTuples.SPTuple2 <float, float> newPos = SPTrig.RotatePointClockwise(xPos, yPos, 45f);
                    bracketLocs[i].x = newPos.First + worldPos.x;
                    bracketLocs[i].z = newPos.Second + worldPos.z;
                }
                break;

            case -45:
                for (int i = 0; i < 4; i++)
                {
                    float xPos = bracketLocs[i].x - worldPos.x;
                    float yPos = bracketLocs[i].z - worldPos.z;
                    SPTuples.SPTuple2 <float, float> newPos = SPTrig.RotatePointCounterClockwise(xPos, yPos, 45f);
                    bracketLocs[i].x = newPos.First + worldPos.x;
                    bracketLocs[i].z = newPos.Second + worldPos.z;
                }
                break;
            }
        }