public void load(CanalManagerData canalManagerData) { _canalsMatrix = new CanalTile[canalManagerData.MapHeight, canalManagerData.MapWidth]; _canalsMatrixTmp = new CanalTile[canalManagerData.MapHeight, canalManagerData.MapWidth]; for (int i = 0; i < canalManagerData.MapHeight; ++i) { for (int j = 0; j < canalManagerData.MapWidth; ++j) { if (canalManagerData.CanalsMatrix[i, j] != null) { uint row = canalManagerData.CanalsMatrix[i, j].Row; uint col = canalManagerData.CanalsMatrix[i, j].Col; bool confirmed = canalManagerData.CanalsMatrix[i, j].Confirmed; _canalsMatrix[i, j] = new CanalTile(row, col, !confirmed); } } } _riceChunkHasWater = canalManagerData.RiceChunkHasWater; _riceChunkMatrix = canalManagerData.RiceChunkMatrix; _mapW = canalManagerData.MapWidth; _mapH = canalManagerData.MapHeight; _waterSources = canalManagerData.WaterSources; updateCanals(); }
public void addCanal(uint i, uint j, bool update = true) { Debug.Assert(!tileHasCanal(i, j)); _canalsMatrix [i, j] = new CanalTile(i, j, false); if (update) { updateCanals(); } }
public void addCanalTmp(uint i, uint j, bool update = true) { Debug.Log("CanalManager::addCanalTmp"); Debug.Assert(!tileHasCanal(i, j)); Debug.Assert(!tileHasCanalTmp(i, j)); _canalsMatrixTmp [i, j] = new CanalTile(i, j, true); if (update) { updateCanals(); } }
public CanalManager(uint w, uint h) { _mapW = w; _mapH = h; _waterSources = new List <uintPair> (); _canalsMatrix = new CanalTile[_mapH, _mapW]; _canalsMatrixTmp = new CanalTile[_mapH, _mapW]; _riceChunkHasWater = new Dictionary <int, bool> (); _riceChunkMatrix = new int[_mapH, _mapW]; for (int i = 0; i < _mapH; ++i) { for (int j = 0; j < _mapW; ++j) { _riceChunkMatrix [i, j] = -1; } } CanalTile.initResources(); }
public CanalManager() { CanalTile.initResources(); }