public override void SetupPlayer(WorldMap newWorld, Address mapAdress, Address spawnPoint)
        {
            if (newWorld.maps == null || newWorld.size_X <= 0 || newWorld.size_Y <= 0)
                return;

            currentWorld = newWorld;

            //Resize player to cell size
            //if (ProDManager.Instance.topREPLACEDown)
            //{
            //    transform.localScale = new Vector3(ProDManager.Instance.tileSpacingX, 1, ProDManager.Instance.tileSpacingY);
            //}
            //else
            //{
            //    transform.localScale = new Vector3(ProDManager.Instance.tileSpacingX, ProDManager.Instance.tileSpacingY, 1);
            //}

            if (currentWorld == null || mapAdress.x < 0 || mapAdress.x >= currentWorld.size_X ||
                mapAdress.y < 0 || mapAdress.y >= currentWorld.size_Y)
                return;

            currentMap = currentWorld.maps[mapAdress.x, mapAdress.y];
            if (spawnPoint == null)
            {
                List<Cell> placementList = new List<Cell>();
                foreach (string walkableType in walkableCellTypes)
                    placementList.AddRange(MethodLibrary.GetListOfCellType(walkableType, currentMap));
                MoveToCell(placementList[Random.Range(0, placementList.Count - 1)]);
            }
            else
                MoveToCell(currentMap.GetCell(spawnPoint.x, spawnPoint.y));
        }
		public static WorldMap Generate(string generatorName, int world_Size_X, int world_Size_Y, int map_Size_X, int map_Size_Y)
		{
			_worldMap_Size_X = world_Size_X;
			_worldMap_Size_Y = world_Size_Y;
			_map_Size_X = map_Size_X;
			_map_Size_Y = map_Size_Y;

			worldMap = new WorldMap(_worldMap_Size_X, _worldMap_Size_Y);

			for (int i = 0; i < _worldMap_Size_X; i++) 
			{
				for (int j = 0; j < _worldMap_Size_Y; j++) 
				{
					Map tempMap = new Map();
					//tempMap = Generator_Dungeon.Generate();
					
					switch (generatorName) 
					{
					case "Cavern":
						Generator_Cavern.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_Cavern.Generate();
						break;
					case "Dungeon":
						Generator_Dungeon.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_Dungeon.Generate();
						break;
					case "AlternativeDungeon":
						Generator_AlternativeDungeon.SetGenericProperties(_map_Size_X, _map_Size_Y, theme);
						tempMap = Generator_AlternativeDungeon.Generate();
						break;
					case "DungeonRuins":
						Generator_DungeonRuins.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_DungeonRuins.Generate();
						break;
					case "RockyHill":
						Generator_RockyHill.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_RockyHill.Generate();
						break;
					case "Maze":
						Generator_Maze.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);	
						tempMap = Generator_Maze.Generate();
						break;
					case "ObstacleBiome":
						Generator_ObstacleBiome.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_ObstacleBiome.Generate();
						break;
					case "PerlinLikeBiome":
						Generator_PerlinLikeBiome.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_PerlinLikeBiome.Generate();
						break;
					case "StickDungeon":
						Generator_StickDungeon.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_StickDungeon.Generate();
						break;
					case "StickBiome":
						Generator_StickBiome.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
						tempMap = Generator_StickBiome.Generate();
						break;
					case "RoundRooms":
						Generator_RoundRooms.SetGenericProperties(_map_Size_X, _map_Size_Y, theme);
						tempMap = Generator_RoundRooms.Generate();
						break;
					case "DwarfTown":
						Generator_DwarfTown.SetGenericProperties(_map_Size_X, _map_Size_Y, theme);
						tempMap = Generator_DwarfTown.Generate();
						break;
					case "Castle":
						Generator_Castle.SetGenericProperties(_map_Size_X, _map_Size_Y, theme);
						tempMap = Generator_Castle.Generate();
						break;
					default:
						Generator_Maze.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);	
						tempMap = Generator_Maze.Generate();
					break;
					}
					
					tempMap.addressOnWorldMap = new Address(i,j);
					tempMap.worldMap = worldMap;
					worldMap.maps[i,j] = tempMap;
				}
			}
			return worldMap;
		}
        public static WorldMap Generate(List<string> mapTypes, int map_Size_X, int map_Size_Y)
        {
            int tempX = 1;
            int tempY = 1;
            while (tempX * tempY < mapTypes.Count)
            {
                tempX++;
                if (tempX * tempY < mapTypes.Count)
                    tempY++;
            }
            _worldMap_Size_X = tempX;
            _worldMap_Size_Y = tempY;
            _map_Size_X = map_Size_X;
            _map_Size_Y = map_Size_Y;

            worldMap = new WorldMap(_worldMap_Size_X, _worldMap_Size_Y);

            int typeIndex = 0;
            for (int j = 0; j < _worldMap_Size_Y; j++)
            {
                for (int i = 0; i < _worldMap_Size_X; i++)
                {
                    string generatorName = "Empty";
                    if (typeIndex < mapTypes.Count)
                        generatorName = mapTypes[typeIndex];

                    Map tempMap = new Map();
                    //tempMap = Generator_Dungeon.Generate();

                    switch (generatorName)
                    {
                    case "Cavern":
                        Generator_Cavern.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_Cavern.Generate();
                        break;
                    case "Dungeon":
                        Generator_Dungeon.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_Dungeon.Generate();
                        break;
                    case "DungeonRuins":
                        Generator_DungeonRuins.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_DungeonRuins.Generate();
                        break;
                    case "Hill":
                        Generator_RockyHill.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_RockyHill.Generate();
                        break;
                    case "Maze":
                        Generator_Maze.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_Maze.Generate();
                        break;
                    case "ObstacleBiome":
                        Generator_ObstacleBiome.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_ObstacleBiome.Generate();
                        break;
                    case "PerlinLikeBiome":
                        Generator_PerlinLikeBiome.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_PerlinLikeBiome.Generate();
                        break;
                    case "StickBiome":
                        Generator_StickDungeon.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_StickDungeon.Generate();
                        break;
                    default:
                        Generator_EmptyMap.SetGenericProperties(_map_Size_X,_map_Size_Y, theme);
                        tempMap = Generator_EmptyMap.Generate();
                    break;
                    }

                    tempMap.addressOnWorldMap = new Address(i,j);
                    tempMap.worldMap = worldMap;
                    worldMap.maps[i,j] = tempMap;
                    typeIndex++;
                }
            }
            return worldMap;
        }
 public override void SetupPlayer(WorldMap newWorld)
 {
     SetupPlayer(newWorld, new Address(0, 0), null);
 }
示例#5
0
 public virtual void SetupPlayer(WorldMap newWorld, Address mapAdress, Address spawnPoint)
 {
     //Override this in respective movement scripts.
 }
示例#6
0
 public virtual void SetupPlayer(WorldMap newWorld)
 {
     //Override this in respective movement scripts.
 }
示例#7
0
 public override void SetupPlayer(WorldMap newWorld)
 {
     //Random.Range(0, newWorld.size_X), Random.Range(0, newWorld.size_Y)
     SetupPlayer(newWorld, new Address(0,0), null);
 }