internal void Initialize( GameObject thisParent, int worldWidth, int worldHeight ) { parent = thisParent; worldTiles = new WorldTile[worldWidth, worldHeight]; season = GameObject.FindGameObjectWithTag ( "Manager" ).GetComponent<TimeManager>().currentSeason (); Color[,] heightmap = GeneratePerlinNoise ( 1.0f, 1.0f, worldWidth, worldHeight ); int widthIndex = 0; int heightIndex = 0; while ( heightIndex < worldTiles.GetLength ( 1 )) { while ( heightIndex < worldHeight ) { while ( widthIndex < worldWidth ) { float localHeight = 0; if ( heightmap[ widthIndex, heightIndex ].grayscale > 0.5f ) { localHeight = 5; } WorldTile newTile = new WorldTile (); newTile.Initialize ( this, widthIndex, localHeight, heightIndex); worldTiles[widthIndex, heightIndex] = newTile; widthIndex += 1; } widthIndex = 0; heightIndex += 1; } } }