//static int min = int.MaxValue; //static int max = int.MinValue; public void UpdateMap() { int initTile = LogicTile.SetTerrain(0, TerrainType.Grass); initTile = LogicTile.SetAltitude(initTile, LogicTile.MAX_ALTITUDE / 2); map.Clear(initTile); GenerateMap(); //AltitudeAbsNoise(map, 5, seed, 100); //AltitudeNoise(map, 5, seed, 40); //AltitudeNoise(map, 6, seed, 20); //Noise(map, seed); /* * int gridSize = 8; * int gridRowCount = 5; * LogicHex center = new LogicHex(map.width/2,map.height/2); * LogicHex start = center.Sub(new LogicHex(gridSize * gridRowCount / 2, gridSize * gridRowCount / 2)); * * List<LogicHex> nodes = CreateGrid(gridSize, gridRowCount); * OffsetNodes(nodes, start); * RandomOffsetNodes(nodes, 7, seed); * * PlotNodes(map, nodes, 3, TerrainType.Sand); */ //int min, max; //GetAltitudeRange(map, out min, out max); /* * if (min < LogicWorld.min) * LogicWorld.min = min; * * if (max > LogicWorld.max) * LogicWorld.max = max; * * Debugger.Log("Altitude range 1 [" + LogicWorld.min + " - " + LogicWorld.max + "]"); * Debugger.Log("Altitude range 2 [" + LogicPerlinNoise.minNoise + " - " + LogicPerlinNoise.maxNoise + "]"); */ /*for(int i = -LogicPerlinNoise.SCALE; i < LogicPerlinNoise.SCALE; ++i) * { * int altitude = LogicPerlinNoise.ScaleNoise(i,LogicTile.MAX_ALTITUDE); * * if (altitude < min) * min = altitude; * * if (altitude > max) * max = altitude; * * }*/ //Debugger.Log("Altitude range 3 [" + min + " - " + max + "]"); }
public static void PlotNodes(LogicHexMap map, List <LogicHex> nodes, int radius, TerrainType terrain) { for (int i = 0; i < nodes.Count; ++i) { LogicHex node = nodes[i]; int tile = map.Get(node); tile = LogicTile.SetTerrain(tile, terrain); map.Set(node, tile); } }
public void Touch2Hex(LogicHex hex) { //tiles.Clear(); int tile = LogicTile.SetTerrain(0, TerrainType.Rock); //LogicHex origo = new LogicHex(9, 9); //tiles.Set(origo, tile); touch2 = hex; UpdateMap(); //map.Set(hex, tile); }
public LogicIntArray2 CreateRoom(int width, int height, int tileHeight) { int tile = 0; tile = LogicTile.SetTerrain(tile, TerrainType.Dirt); tile = LogicTile.SetRoom(tile, 1); tile = LogicTile.SetAltitude(tile, tileHeight); LogicIntArray2 room = new LogicIntArray2(width, height, tile); /* * for (int y = 0; y < width; ++y) * { * for (int x = 0; x < width; ++x) * { * room.Set(x,y,tile); * } * }*/ return(room); }
public int GetLogicTile() { int tile = LogicTile.SetAltitude(0, altitude / TILE_ALTITUDE_SCALE); return(LogicTile.SetTerrain(tile, terrain)); }