Ejemplo n.º 1
0
    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();
    }
Ejemplo n.º 2
0
 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();
     }
 }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
    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();
    }
Ejemplo n.º 5
0
 public CanalManager()
 {
     CanalTile.initResources();
 }