private static TotemLocation ShiftForPlayerIndex(TotemLocation totemLocation) { int pixelsToShift = -30 + totemLocation.PlayerIndex * 20; var directionToShift = new int[2]; if (totemLocation.BoardIndex < 10) { directionToShift[0] = 0; directionToShift[1] = 1; } else if (totemLocation.BoardIndex < 20) { directionToShift[0] = -1; directionToShift[1] = 0; } else if (totemLocation.BoardIndex < 30) { directionToShift[0] = 0; directionToShift[1] = -1; } else { directionToShift[0] = 1; directionToShift[1] = 0; } return new TotemLocation(totemLocation.OffsetFromLeft + directionToShift[0] * pixelsToShift, totemLocation.OffsetFromTop + directionToShift[1]*pixelsToShift, totemLocation.PlayerIndex, totemLocation.BoardIndex); }
public static TotemLocation GetLocationOnBoard(Player player) { var location = GetMidpointOf(player.Location.Index); var totemLocation = new TotemLocation(location.OffsetFromLeft, location.OffsetFromTop, player.Index, player.Location.Index); var adjustedPoint = AdjustPointToTopLeftOfTotem(totemLocation); var finalPoint = ShiftForPlayerIndex(adjustedPoint); return finalPoint; }
private static TotemLocation AdjustPointToTopLeftOfTotem(TotemLocation totemLocation) { return new TotemLocation(totemLocation.OffsetFromLeft-15, totemLocation.OffsetFromTop-15, totemLocation.PlayerIndex, totemLocation.BoardIndex); }