World: use single multi-line string instead of a string[]

GitOrigin-RevId: 38c0745c95e2341a1a2712d480f6403a6ec68ecf
This commit is contained in:
Colin McMillen 2020-01-17 12:15:56 -05:00
parent a719e5b370
commit 03b8688f1e

View File

@ -91,26 +91,26 @@ namespace SemiColinGames {
public int Width { get; }
public int Height { get; }
string[] worldDesc = new string[] {
" ",
" ",
" ",
" ",
" ",
" X ",
" . ",
" X <======> <==X X <=> <XX> XX . ",
" XXX . ",
" XXXX . ",
" XXXXX . ",
" X <X=X> <> <> <X> = <> X X X X <> X X XX X <=X> XXXXXX . ",
" <> [] [] XX XX XXX XX XXXXXXX . ",
" <> [] [] [] XXX XXX XXXX XXX <> <> XXXXXXXX ",
" []12345678[]123456[]123456789[]1234567890 123456 123456 12345 1234 12345 1234 123XXXX XXXX1234XXXXX XXXX1234[]123 1234567[]XXXXXXXXX12345678 ",
"===========================..========..======..=========..=========> <=============> <==============================================================> <=======..==============..==============================",
"...................................................................] [.............] [..............................................................] [......................................................." };
string worldString = @"
X
.
X <======> <==X X <=> <XX> XX .
XXX .
XXXX .
XXXXX .
X <X=X> <> <> <X> = <> X X X X <> X X XX X <=X> XXXXXX .
<> [] [] XX XX XXX XX XXXXXXX .
<> [] [] [] XXX XXX XXXX XXX <> <> XXXXXXXX
[]12345678[]123456[]123456789[]1234567890 123456 123456 12345 1234 12345 1234 123XXXX XXXX1234XXXXX XXXX1234[]123 1234567[]XXXXXXXXX12345678
===========================..========..======..=========..=========> <=============> <==============================================================> <=======..==============..==============================
...................................................................] [.............] [..............................................................] [.......................................................";
public World(Texture2D texture) {
string[] worldDesc = worldString.Split('\n');
width = worldDesc.AsQueryable().Max(a => a.Length);
height = worldDesc.Length;
Debug.WriteLine("world size: {0}x{1}", width, height);