using UnityEngine; using System.Collections.Generic; [System.Serializable] public class GeographicFeature { public string name; public GeographicFeatureType type; public Vector2Int centerPosition; public List tiles; public bool isDiscovered = false; public GeographicFeature(string name, GeographicFeatureType type, Vector2Int centerPosition) { this.name = name; this.type = type; this.centerPosition = centerPosition; this.tiles = new List(); this.isDiscovered = false; } public void AddTile(Vector2Int tile) { if (!tiles.Contains(tile)) { tiles.Add(tile); } } public Vector2Int GetCenterPosition() { if (tiles.Count == 0) return centerPosition; Vector2 sum = Vector2.zero; foreach (var tile in tiles) { sum += new Vector2(tile.x, tile.y); } Vector2 center = sum / tiles.Count; return new Vector2Int(Mathf.RoundToInt(center.x), Mathf.RoundToInt(center.y)); } } public enum GeographicFeatureType { Forest, Lake, Plain, Mountain, River }