Esempio n. 1
0
    void searchSideways(Platform p, TileSheet tileSheet, Tile startTile, bool isRightDir)
    {
        bool finding = true;
        Tile currentTile = startTile;

        int addDirNumber = isRightDir ? 1 : -1;

        for (int x = startTile.m_pos.x+addDirNumber;
             x < tileSheet.m_width && x > 0 && finding;
             x += addDirNumber)
        {
          finding = false;

          for (int y = currentTile.m_pos.y - 1; y <= currentTile.m_pos.y + 1; y++)
          {
        Tile t = tileSheet.getTile (x, y);

        if (t != null)
        {
          t.m_meta = (int)Processing.Done;

          if (t.isWalkable ())
          {
            currentTile = t;
            p.addTile (t);

            finding = true;
            break;
          }
        }
          }
        }
    }