예제 #1
0
        public static Task AsyncGenerateIsland(int island, int posX, int posY)
        {
            WorldRefill.isTaskRunning = true;
            WorldRefill.realcount     = 1;
            return(Task.Run(() =>
            {
                switch (island)
                {
                case 0:
                    WorldGen.CloudIsland(posX, posY);

                    for (int x = posX - 20; x < posX + 20; x++)
                    {
                        int cloudsurface()
                        {
                            int cY = posY;
                            while (Main.tile[x, cY].active())
                            {
                                cY--;
                            }
                            cY++;
                            return cY;
                        };
                        WorldGen.SpreadGrassDirect(posX, cloudsurface());
                    }



                    WorldGen.IslandHouse(posX, posY - 6, WorldGen.floatingIslandStyle[WorldGen.genRand.Next(0, WorldGen.floatingIslandStyle.Count() - 1)]);

                    break;

                case 1:
                    WorldGen.DesertCloudIsland(posX, posY);
                    WorldGen.IslandHouse(posX, posY - 6, WorldGen.floatingIslandStyle[WorldGen.genRand.Next(0, WorldGen.floatingIslandStyle.Count() - 1)]);

                    break;

                case 2:

                    WorldGen.SnowCloudIsland(posX, posY);
                    WorldGen.IslandHouse(posX, posY - 6, WorldGen.floatingIslandStyle[WorldGen.genRand.Next(0, WorldGen.floatingIslandStyle.Count() - 1)]);


                    break;

                case 3:
                    WorldGen.CloudLake(posX, posY);
                    break;
                }
            }).ContinueWith((d) => FinishGen()));
        }