Beispiel #1
0
func getShipColor(field *engine.Field) string {
	if field.IsHit {
		if field.IsEmpty() {
			return CELL_MISS_COLOR
		}
		if field.ShipPart.Ship.IsSunken() {
			return field.ShipPart.Ship.Player.Color.HitAndSunk
		}
		return field.ShipPart.Ship.Player.Color.Hit
	}

	return CELL_BASE_COLOR
}
Beispiel #2
0
func getShipColorOnShootPage(field *engine.Field, player *engine.Player) string {
	if !field.IsHit && field.GetPlayerId() == player.Id {
		return CELL_PLAYER_COLOR
	}
	return getShipColor(field)
}