| 123456789101112131415161718192021222324252627282930313233343536 |
- using UnityEngine;
- [System.Serializable]
- public class MapTile
- {
- public TerrainType terrainType;
- public FeatureType featureType;
- public int x, y;
- public float height;
- public bool isWalkable;
- public string name; // For towns/villages
- public MapTile(int x, int y)
- {
- this.x = x;
- this.y = y;
- this.terrainType = TerrainType.Plains;
- this.featureType = FeatureType.None;
- this.height = 0f;
- this.isWalkable = true;
- this.name = string.Empty;
- }
- public bool IsWater()
- {
- return terrainType == TerrainType.Ocean ||
- terrainType == TerrainType.Lake ||
- terrainType == TerrainType.River;
- }
- public bool CanBuildOn()
- {
- return terrainType == TerrainType.Plains &&
- featureType == FeatureType.None;
- }
- }
|