コード例 #1
0
 public MeshGenerator(CaveMapController caveMap)
 {
     _edgesMesh = caveMap.EdgesMesh;
     _wallsMesh = caveMap.WallsMesh;
     _grassMesh = caveMap.GrassMesh;
     _floor     = caveMap.Floor;
 }
コード例 #2
0
    /// <summary>
    /// Generates a cave by applying the cellular automaton  model to a 2D grid
    /// </summary>
    /// <param name="width">Map width</param>
    /// <param name="height">Map height</param>
    /// <param name="wallDensity">An integer between 0 and 100 determining wall to free-space ratio</param>
    /// <param name="caveMap">Reference to the CaveMap GameObject</param>
    public override void GenerateMap(int width, int height, int wallDensity, CaveMapController caveMap)
    {
        _caveMap      = caveMap;
        _mapWidth     = width;
        _mapHeight    = height;
        _wallDensity  = wallDensity < 0 ? 0 : (wallDensity > 100 ? 100 : wallDensity);
        _grassDensity = wallDensity + ((randomMax - wallDensity) / 3);

        _map = new TileType[_mapWidth, _mapHeight];
        FillMap();
        SmoothMap();
        RemoveIsolations();

        var           borderedMap = CreateMapBorder();
        MeshGenerator meshGen     = new MeshGenerator(caveMap);

        meshGen.GenerateMesh(borderedMap, 1);
    }
コード例 #3
0
 /// <summary>
 /// Generates a cave by applying the cellular automaton  model to a 2D grid
 /// </summary>
 /// <param name="width">Map width</param>
 /// <param name="height">Map height</param>
 /// <param name="wallDensity">An integer between 0 and 100 determining wall to free-space ratio</param>
 /// <param name="caveMap">Reference to the CaveMap GameObject</param>
 public abstract void GenerateMap(int width, int height, int wallDensity, CaveMapController caveMap);