public override void boardSetup() { boardHolder = new GameObject ("Board").transform; // Generate a map from Cellular Automata. // CellularAutomata foo = new CellularAutomata(rows, columns); //PureRandom foo = new PureRandom(rows, columns); GameObject playerChar = GameObject.FindGameObjectWithTag("Player"); selectedRule.initializeMap (); selectedRule.generateMap (); Tile[,] mapConvert = selectedRule.map; MapValidationFunctions mvf = new MapValidationFunctions(); Coord startPoint = new Coord(floodStartX,floodStartY); Coord endPoint = new Coord(floodGoalX, floodGoalY); mvf.FloodFillCheck(selectedRule.map, startPoint, endPoint); // This is the autotiler phase. // // Let's try this method of instantiating the prefab of our choice... GameObject tileInstance = Instantiate(tilesetToUse, new Vector3(0,0,0), Quaternion.identity) as GameObject; selectedTileset = tileInstance.GetComponent<Tileset>(); selectedTileset.autoTiler( mapConvert ); if(MapValidationFunctions.clearable) Debug.Log ("The goal has been found!"); else Debug.Log ("I can't find the goal."); //convertTiles( mapConvert ); }
/* // Autotiler will be kind of built upon this. public void convertTiles( Tile[,] mapConvert ) { for(int x = 0; x < rows; x++) { for(int y = 0; y < columns; y++) { GameObject instantiateMe; // Todo: Change this into a general function that // takes in an enum and does a better job with tile conversion. if( mapConvert[x,y].property == TileType.OuterWall1 ) instantiateMe = wallTile; else if ( mapConvert[x,y].property == TileType.Floor1 ) instantiateMe = floorTile; else if ( mapConvert[x,y].property == TileType.Door1 ) instantiateMe = doorTile; else instantiateMe = pillarTile; GameObject instance = Instantiate(instantiateMe, new Vector3 (x, y, 0), Quaternion.identity) as GameObject; instance.transform.SetParent(boardHolder); } } } */ public void boardSetup() { boardHolder = new GameObject ("Board").transform; // Generate a map from Cellular Automata. // CellularAutomata foo = new CellularAutomata(rows, columns); //PureRandom foo = new PureRandom(rows, columns); GameObject playerChar = GameObject.FindGameObjectWithTag("Player"); selectedRule.initializeMap (); selectedRule.generateMap (); Tile[,] mapConvert = selectedRule.map; // This is the autotiler phase. // // Let's try this method of instantiating the prefab of our choice... GameObject tileInstance = Instantiate(tilesetToUse, new Vector3(0,0,0), Quaternion.identity) as GameObject; selectedTileset = tileInstance.GetComponent<Tileset>(); selectedTileset.autoTiler( mapConvert ); //convertTiles( mapConvert ); }