Beispiel #1
0
        public void HaveFun(Game room, StringBuilder sb, string preferredMap, bool isSingle, int singleCharId)
        {
            int roomId = room.Id;

            //Create dice
            DiceDto dice = new DiceDto();

            //Add Characters to the room
            var game       = context.Games.FirstOrDefault(g => g.Id == room.Id);
            var characters = new List <Character>();

            foreach (var gc in game.Characters)
            {
                var character = gc.Character;
                characters.Add(character);
            }


            if (preferredMap == "demomap")
            {
                var map         = new DemoMap("map1");
                var playableMap = map.GenerateMap();
                SetOnStart(room, playableMap, roomId);// set all chars on start
                if (!isSingle)
                {
                    ProceedGame(game, sb, playableMap, characters, dice, roomId);
                }
                else
                {
                    var gaChar       = context.GameCharacters.FirstOrDefault(gc => gc.CharacterId == singleCharId && gc.GameId == roomId);
                    var singlePlayer = new SinglePlayer(context, reader, writer, numberGenerator);
                    singlePlayer.StartSinglePlayer(dice, gaChar, playableMap, characters, sb, roomId, game);
                }
            }
            else if (preferredMap == "firstmap")
            {
                var firstMap          = new FirstMapFrontEnd();
                var generatedFirstMap = firstMap.GenerateFirstMap();
                SetOnStart(room, generatedFirstMap, roomId);// set all chars on start
                if (!isSingle)
                {
                    ProceedGame(game, sb, generatedFirstMap, characters, dice, roomId);
                }
                else
                {
                    var gaChar       = context.GameCharacters.FirstOrDefault(gc => gc.CharacterId == singleCharId && gc.GameId == roomId);
                    var singlePlayer = new SinglePlayer(context, reader, writer, numberGenerator);
                    singlePlayer.StartSinglePlayer(dice, gaChar, generatedFirstMap, characters, sb, roomId, game);
                }
            }
        }
Beispiel #2
0
 public string Get() => Serializer.ExportFirstMapCoordinates(FirstMapFrontEnd.GetMapPath());