44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace HexGrid
|
|
{
|
|
public class HexZoneController : MonoBehaviour,IZoneController
|
|
{
|
|
//
|
|
private HexZone _zoneData;
|
|
private IBuildMediator _buildMediator;
|
|
private void Awake()
|
|
{
|
|
Log("Awake()-> ");
|
|
}
|
|
private static void Log(object t)
|
|
{
|
|
Debug.Log($"<color=yellow>HexZoneController -> {t} </color>");
|
|
}
|
|
|
|
public void LoadData(HexZone zoneData)
|
|
{
|
|
_zoneData = zoneData;
|
|
}
|
|
|
|
public void UpdateZoneStatus()
|
|
{
|
|
Log("UpdateZoneStatus() -> ");
|
|
}
|
|
|
|
public void OnHexCellClicked(HexTile tiler)
|
|
{
|
|
Log($"OnHexCellClicked -> {tiler}");
|
|
|
|
var tiles = _zoneData.tiles;
|
|
foreach (var tileData in tiles.Where(tileData => tileData.tileId == tiler.tileId))
|
|
{
|
|
tileData.tileStatus = tiler.tileStatus;
|
|
break;
|
|
}
|
|
// _buildMediator?.CheckForBuilding(_zoneData.subZones);
|
|
}
|
|
|
|
}
|
|
} |