Exemple #1
0
        public override void EnterState(GameLevel gameLevel)
        {
            gameLevel.DoForAllPlayers(player =>
            {
                player.RemoveAllEffects();

                player.SetGameMode(GameMode.Adventure);
            });

            GameLevelInfo gameLevelInfo = gameLevel.GameLevelInfo;

            //Spawn Lobby NPC
            if (gameLevelInfo.LobbyNPCLocation == null)
            {
                gameLevelInfo.LobbyNPCLocation = new PlayerLocation(260.5, 15, 251.5);

                File.WriteAllText(GameController.GetGameLevelInfoLocation(gameLevel.GameType, gameLevel.LevelName), JsonConvert.SerializeObject(gameLevel.GameLevelInfo, Formatting.Indented));
                SkyUtil.log($"LobbyNPCLocation Updated with default value for {gameLevel.LevelName}");
            }

            _spawnedEntities = PlayerNPC.SpawnLobbyNPC(gameLevel, gameLevelInfo.GameType, gameLevel.GameLevelInfo.LobbyNPCLocation);

            gameLevel.AddPendingTask(() =>
            {
                //Spawn Lobby Map/Image
                if (gameLevelInfo.LobbyMapLocation.Y < 0)         //Default == -1
                {
                    gameLevelInfo.LobbyMapLocation = new BlockCoordinates(252, 15, 249);

                    File.WriteAllText(GameController.GetGameLevelInfoLocation(gameLevel.GameType, gameLevel.LevelName), JsonConvert.SerializeObject(gameLevel.GameLevelInfo, Formatting.Indented));
                }

                _spawnedEntities.AddRange(MapUtil.SpawnMapImage(@"C:\Users\Administrator\Desktop\dl\map-images\TestImage.png", 7, 4, gameLevel, gameLevelInfo.LobbyMapLocation));
            });
        }