Esempio n. 1
0
    /*void OnDrawGizmos()
     * {
     *  if (map != null)
     *  {
     *      for(int x = 0; x < resolution; x++)
     *      {
     *          for(int y = 0; y < resolution; y++)
     *          {
     *              Gizmos.color = map[x, y] == 1 ? Color.black : Color.white;
     *              Vector3 position = new Vector3(-resolution / 2 + x + 0.5f, -resolution / 2 + y + 0.5f, 0);
     *              Gizmos.DrawCube(position, Vector3.one);
     *          }
     *      }
     *  }
     * }*/

    public void GenerateMap()
    {
        map = new int[resolution, resolution];
        //FillOuterWalls();
        FillMapRandomly();
        for (int i = 0; i < 5; i++)
        {
            Smooth();
        }

        map = AddBorders(map, 2);
        meshController.GenerateMapMesh(map, 2);
    }