Beispiel #1
0
        public async Task ExecuteMapChange()
        {
            try
            {
                await MapChanger.ChangeMap(TheEvent.MapID, TheEvent.TargetEntryPoint);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);

                SoundMan.PlaySound(LotaSound.Bad);

                await TextArea.Print("Failed to load ", XleColor.White);

                await TextArea.Print(GetMapName(), XleColor.Red);

                await TextArea.Print(".", XleColor.White);

                await TextArea.PrintLine();

                await TextArea.PrintLine();

                await GameControl.WaitAsync(1500);
            }
        }
 public MapChunk(
     Vector3 location,
     int xResolution,
     int zResolution,
     float scale,
     Material material,
     MeshFilter meshFilter,
     MeshRenderer meshRenderer,
     MeshCollider meshCollider,
     int i,
     int j,
     MapChanger mapChanger,
     MapChunksAccessor mapChunksAccessor)
 {
     Location               = location;
     XResolution            = xResolution;
     ZResolution            = zResolution;
     Scale                  = scale;
     Material               = material;
     _meshRenderer          = meshRenderer;
     _meshCollider          = meshCollider;
     _meshFilter            = meshFilter;
     _i                     = i;
     _j                     = j;
     XLocationAmongstChunks = _i;
     ZLocationAmongstChunks = _j;
     _mapChanger            = mapChanger;
     _mapChunksAccessor     = mapChunksAccessor;
 }
Beispiel #3
0
        public override async Task RunExhibit()
        {
            await base.RunExhibit();

            await TextArea.PrintLine("Would you like to go");

            await TextArea.PrintLine("to the pirate's lair?");

            await TextArea.PrintLine();

            if (await QuickMenu.QuickMenu(new MenuItemList("Yes", "no"), 3) == 0)
            {
                await ReadRawText(ExhibitInfo.Text[2]);

                for (int i = 0; i < 8; i++)
                {
                    await GameControl.WaitAsync(50);

                    TextArea.SetCharacterColor(2, 12 + i, XleColor.Cyan);
                }

                await GameControl.WaitForKey();

                await MapChanger.ChangeMap(2, 0);
            }
        }
Beispiel #4
0
 public MapChunk GenerateMap(int i, int j, MapChanger mapChanger, MapChunksAccessor MapChunksAccessor)
 {
     try
     {
         var frame = new MapChunk(
             Location,
             XResolution,
             ZResolution,
             Scale,
             Material,
             GetComponent <MeshFilter>(),
             GetComponent <MeshRenderer>(),
             GetComponent <MeshCollider>(),
             i,
             j,
             mapChanger,
             MapChunksAccessor);
         frame.Build();
         return(frame);
     }
     catch (Exception e)
     {
         print("MapChanger generator error: " + e.Message);
         throw e;
     }
 }
 private static void EncodeSeedTest()
 {
     for (int i = 0; i < 100; i++)
     {
         RandoSettings.Seed = RandoSettings.NewSeed();
         Console.WriteLine("Encoding Seed: " + RandoSettings.Seed);
         foreach (string sprite in MapChanger.SpriteSeed())
         {
             Console.WriteLine("--" + sprite);
         }
     }
 }
Beispiel #6
0
        private MapChunk CreateTerrainChunk(int i, int j, MapChanger mapChanger, MapChunksAccessor MapChunksAccessor, Vector2 location, int chunkSizeX, int chunkSizeZ)
        {
            MapChunkBuilder chunk = Instantiate(mapChunkPrefab);

            chunk.Location    = new Vector3(location.x, 0, location.y);
            chunk.XResolution = chunkSizeX;
            chunk.ZResolution = chunkSizeZ;
            chunk.Scale       = 1;
            var frame = chunk.GenerateMap(i, j, mapChanger, MapChunksAccessor);

            chunk.transform.SetParent(transform);

            return(frame);
        }
Beispiel #7
0
        public async Task LeaveMap()
        {
            await TextArea.PrintLine();

            await TextArea.PrintLine("Leave " + TheMap.MapName);

            await TextArea.PrintLine();

            await GameControl.WaitAsync(GameState.GameSpeed.LeaveMapTime);

            await MapChanger.ReturnToPreviousMap();

            await TextArea.PrintLine();
        }
Beispiel #8
0
        public override async Task RunExhibit()
        {
            await base.RunExhibit();

            await TextArea.PrintLine("Would you like to go");

            await TextArea.PrintLine("to Marthbane tunnels?");

            await TextArea.PrintLine();

            if (0 == await QuickMenu.QuickMenuYesNo())
            {
                await MapChanger.ChangeMap(4, 0);
            }
        }
Beispiel #9
0
        public override async Task RunExhibit()
        {
            await ReadRawText(RawText);

            int       map    = Player.MapID;
            int       x      = Player.X;
            int       y      = Player.Y;
            Direction facing = Player.FaceDirection;

            await MapChanger.ChangeMap(72, 0);

            Player.SetReturnLocation(map, x, y, facing);

            MarkAsVisited();
        }
Beispiel #10
0
        public override async Task RunExhibit()
        {
            await base.RunExhibit();

            await TextArea.PrintLine("Would you like to go");

            await TextArea.PrintLine("to the island caverns now?");

            await TextArea.PrintLine();

            if (await QuickMenu.QuickMenuYesNo() == 0)
            {
                await MapChanger.ChangeMap(1, 1);
            }
        }
Beispiel #11
0
        void Awake()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            var time1 = stopwatch.ElapsedMilliseconds;

            print("time1 " + time1);

            var chunksCountX = (int)Mathf.Ceil((float)xResolution / MaxResolutionOfSingleChunk);
            int chunkSizeX   = xResolution / chunksCountX;

            var chunksCountZ = (int)Mathf.Ceil((float)zResolution / MaxResolutionOfSingleChunk);
            int chunkSizeZ   = zResolution / chunksCountZ;

            var chunks = new MapChunk[chunksCountX, chunksCountZ];

            var MapChunksAccessor = new MapChunksAccessor();
            var mapChanger        = new MapChanger(
                xResolution,
                zResolution,
                MapChunksAccessor);


            for (int i = 0; i < chunksCountX; i++)
            {
                for (int j = 0; j < chunksCountZ; j++)
                {
                    chunks[i, j] = CreateTerrainChunk(i, j, mapChanger, MapChunksAccessor, new Vector2(i * chunkSizeX * meshScale, j * chunkSizeZ * meshScale), chunkSizeX, chunkSizeZ);
                }
            }

            MapChunksAccessor.Recalculate(mapChanger);

            var randomMapGenerator = new RandomMapGenerator(mapChanger);

            randomMapGenerator.GenerateFor();

            foreach (var mapChunk in chunks)
            {
                mapChunk.CommitChanges();
            }

            var time2 = stopwatch.ElapsedMilliseconds;

            print("time2 " + time2);
        }
Beispiel #12
0
        public override async Task RunExhibit()
        {
            if (await CheckOfferReread())
            {
                await ReadRawText(ExhibitInfo.Text[1]);
            }

            await TextArea.PrintLine("Would you like to go");

            await TextArea.PrintLine("to thornberry?");

            await TextArea.PrintLine();

            if (await QuickMenu.QuickMenu(new MenuItemList("Yes", "no"), 3) == 0)
            {
                await ReadRawText(ExhibitInfo.Text[2]);

                int amount = 100;

                if (HasBeenVisited || ExhibitHasBeenVisited(ExhibitIdentifier.Fountain))
                {
                    amount += 200;
                }

                Player.Gold += amount;

                await TextArea.PrintLine();

                await TextArea.PrintLine("             GOLD:  + " + amount.ToString(), XleColor.Yellow);

                SoundMan.PlaySound(LotaSound.VeryGood);
                await GameControl.FlashHPWhileSound(XleColor.Yellow);

                await GameControl.WaitForKey();

                await MapChanger.ChangeMap(11, 0);

                Player.SetReturnLocation(1, 18, 56);
            }

            MarkAsVisited();
        }
Beispiel #13
0
        public override async Task RunExhibit()
        {
            await base.RunExhibit();

            await TextArea.PrintLine();

            await TextArea.PrintLine("Do you want to climb on?");

            await TextArea.PrintLine();

            if (0 == await QuickMenu.QuickMenuYesNo())
            {
                if (Player.Food < 150)
                {
                    Player.Food = 150;
                }

                await MapChanger.ChangeMap(3, 0);
            }
        }
Beispiel #14
0
        public override async Task Execute()
        {
            var tile = DungeonAdapter.TileAt(Player.X, Player.Y);

            switch (tile)
            {
            case DungeonTile.CeilingHole:
                if (Player.DungeonLevel == 0)
                {
                    await TextArea.PrintLine("\n\nYou climb out of the dungeon.");

                    await OnPlayerExitDungeon();

                    await GameControl.WaitAsync(1000);

                    await MapChanger.ReturnToPreviousMap();

                    return;
                }
                else
                {
                    Player.DungeonLevel--;
                }
                break;

            case DungeonTile.FloorHole:
                Player.DungeonLevel++;
                break;

            default:
                await FailMessage();

                return;
            }

            await DungeonLevelText();
        }
Beispiel #15
0
        private async Task CastSeekSpell()
        {
            await TextArea.PrintLine();

            await TextArea.PrintLine("Cast seek spell.");

            if (Player.IsOnRaft)
            {
                await TextArea.PrintLine("The water mutes the spell.");
            }
            else if (TheMap.MapID != 1)
            {
                await TextArea.PrintLine("You're too far away.");
            }
            else
            {
                Player.FaceDirection = Direction.West;
                await GameControl.PlaySoundSync(LotaSound.VeryGood);

                await MapChanger.ChangeMap(1, 0);

                OutsideEncounters.CancelEncounter();
            }
        }
Beispiel #16
0
        public override async Task RunExhibit()
        {
            await base.RunExhibit();

            await TextArea.PrintLine("Would you like to go");

            await TextArea.PrintLine("to the four jewel dungeon?");

            await TextArea.PrintLine();

            if (await QuickMenu.QuickMenuYesNo() == 0)
            {
                int       map    = Player.MapID;
                int       x      = Player.X;
                int       y      = Player.Y;
                Direction facing = Player.FaceDirection;

                Player.DungeonLevel = 0;

                await MapChanger.ChangeMap(73, 0);

                Player.SetReturnLocation(map, x, y, facing);
            }
        }
Beispiel #17
0
 protected virtual async Task LoadOutsideMap()
 {
     await MapChanger.ChangeMap(1, -1);
 }