示例#1
0
        public static void LoadGameWorld(string GameWorldName)
        {
            gameWorldName = GameWorldName;
            string fileText   = File.ReadAllText("C:/AscensionGameFiles/Worlds/" + gameWorldName + ".txt");
            int    fileLength = (fileText.Length <= tileArray.GetLength(0) * tileArray.GetLength(1)) ? fileText.Length : tileArray.GetLength(0) * tileArray.GetLength(1);

            for (int n = 0; n < fileLength; n++)
            {
                int i = n / tileArray.GetLength(1);
                int j = n % tileArray.GetLength(1);
                if (fileText[n] == 'E')
                {
                    tileArray[i, j] = new earthTile(new Vector2(i * tile.tileSize, j * tile.tileSize));
                }
                else if (fileText[n] == 'A')
                {
                    tileArray[i, j] = new airTile(new Vector2(i * tile.tileSize, j * tile.tileSize));
                }
                else if (fileText[n] == 'G')
                {
                    tileArray[i, j] = new goldTile(new Vector2(i * tile.tileSize, j * tile.tileSize));
                }
                else if (fileText[n] == 'W')
                {
                    tileArray[i, j] = new waterTile(new Vector2(i * tile.tileSize, j * tile.tileSize));
                }
            }
        }
示例#2
0
 public static void generateMountains()
 {
     for (int i = 0; i < tileArray.GetLength(0); i++)
     {
         int heightAboveSea = Game1.randomGenerator.Next(maxMountainHeight);
         for (int j = seaLevelWorldHeight / tile.tileSize - heightAboveSea; j < seaLevelWorldHeight / tile.tileSize; j++)
         {
             tileArray[i, j] = new earthTile(new Vector2(i * tile.tileSize, j * tile.tileSize));
         }
     }
 }
示例#3
0
        public static void InitializeTileArray()
        {
            for (int i = 0; i < tileArray.GetLength(0); i++)
            {
                for (int j = 0; j < tileArray.GetLength(1); j++)
                {
                    if (j * 6 >= seaLevelWorldHeight)
                    {
                        tileArray[i, j] = new earthTile(new Vector2(i * tile.tileSize, j * tile.tileSize));
                    }
                    else
                    {
                        tileArray[i, j] = new airTile(new Vector2(i * tile.tileSize, j * tile.tileSize));
                    }
                }
            }

            generateTerrain();
        }