private float FindBestInitialDir(IntVec3 start, List <IntVec3> group, out float dist) { float num = GetDistToNonRock(start, group, IntVec3.East, 40); float num2 = GetDistToNonRock(start, group, IntVec3.West, 40); float num3 = GetDistToNonRock(start, group, IntVec3.South, 40); float num4 = GetDistToNonRock(start, group, IntVec3.North, 40); float num5 = GetDistToNonRock(start, group, IntVec3.NorthWest, 40); float num6 = GetDistToNonRock(start, group, IntVec3.NorthEast, 40); float num7 = GetDistToNonRock(start, group, IntVec3.SouthWest, 40); float num8 = GetDistToNonRock(start, group, IntVec3.SouthEast, 40); dist = Mathf.Max(num, num2, num3, num4, num5, num6, num7, num8); return(GenMath.MaxByRandomIfEqual(0f, num + num8 / 2f + num6 / 2f, 45f, num8 + num3 / 2f + num / 2f, 90f, num3 + num8 / 2f + num7 / 2f, 135f, num7 + num3 / 2f + num2 / 2f, 180f, num2 + num7 / 2f + num5 / 2f, 225f, num5 + num4 / 2f + num2 / 2f, 270f, num4 + num6 / 2f + num5 / 2f, 315f, num6 + num4 / 2f + num / 2f)); }
private float FindBestInitialDir(IntVec3 start, List <IntVec3> group, out float dist) { float distE = (float)GetDistToNonRock(start, group, IntVec3.East, 40); float distW = (float)GetDistToNonRock(start, group, IntVec3.West, 40); float distS = (float)GetDistToNonRock(start, group, IntVec3.South, 40); float distN = (float)GetDistToNonRock(start, group, IntVec3.North, 40); float distNW = (float)GetDistToNonRock(start, group, IntVec3.NorthWest, 40); float distNE = (float)GetDistToNonRock(start, group, IntVec3.NorthEast, 40); float distSW = (float)GetDistToNonRock(start, group, IntVec3.SouthWest, 40); float distSE = (float)GetDistToNonRock(start, group, IntVec3.SouthEast, 40); dist = Mathf.Max(new float[] { distE, distW, distS, distN, distNW, distNE, distSW, distSE }); return(GenMath.MaxByRandomIfEqual <float>(0f, distE + distSE / 2f + distNE / 2f, 45f, distSE + distS / 2f + distE / 2f, 90f, distS + distSE / 2f + distSW / 2f, 135f, distSW + distS / 2f + distW / 2f, 180f, distW + distSW / 2f + distNW / 2f, 225f, distNW + distN / 2f + distW / 2f, 270f, distN + distNE / 2f + distNW / 2f, 315f, distNE + distN / 2f + distE / 2f)); }