public override void _visit(APolyShape shape) { int vZ = shape.topLeftVertex().row(); int vX = shape.topLeftVertex().col(); OIGrid pmap = shape.grid(); pmap.forEach2((row, col, value) => { //0 Wall = BLACK //1 Floor = WHITE if (value == XTile.FLOOR) { Gizmos.color = Color.white; Vector3 pos = new Vector3(vX + col, 0, (vZ + row) * -1); Gizmos.DrawCube(pos, Vector3.one); } else if (value == XTile.WALL && showRoomPerimeter) { Gizmos.color = Color.black; Vector3 pos = new Vector3(vX + col, 0, (vZ + row) * -1); Gizmos.DrawCube(pos, Vector3.one); } //Gizmos.color = (value == 0) ? Color.black : Color.white; //Vector3 pos = new Vector3(vX + x, 0, (vY + y) * -1); //Gizmos.DrawCube(pos, Vector3.one); }); }
private void printInstance(APolyShape aShape, string className) { int row = aShape.topLeftVertex().row(); int col = aShape.topLeftVertex().col(); int rows = aShape.grid().rows(); int cols = aShape.grid().columns(); System.Console.WriteLine(className + " " + _varName + " = new " + className + "(new Cell(" + row + ", " + col + "), new OIGrid(" + rows + ", " + cols + "));"); }
public virtual void visit(APolyShape aShape) { if (aShape is RectShape) { visit(aShape as RectShape); } else if (aShape is ElliShape) { visit(aShape as ElliShape); } else { throw new NotImplementedException("Missing case for: " + aShape.GetType()); } }
public static void printForTest(int seed, params APolyShape[] rooms) { ShapeCellularAutomaton auto = new ShapeCellularAutomaton(seed, 75, 4); CaveBoard board = new CaveBoard(50, 50); for (int i = 0; i < rooms.Length; i++) { APolyShape currRoom = rooms[i]; auto.applyOn(currRoom); currRoom.deleteRegionsButTheBiggest(); if (i > 0) { IXShape prevRoom = rooms[i - 1]; IXShape corr = CaveCorridorFactory.createCorrShape(prevRoom, currRoom, 2); board.addCorridor(corr); } board.addRoom(currRoom); } printForTest(board); }
public virtual void _visit(APolyShape aShape) { }