예제 #1
0
        /// <summary>
        /// Saves connections between <paramref name="room"/> and adjacent rooms.
        /// </summary>
        /// Saves informations aboyt connections to other rooms.
        public async Task SaveExits(RoomModel room)
        {
            var model = new Room
            {
                RoomID = room.Id
            };
            //gets all corrridors(infromations abour connections to other rooms)
            var exits = await _gameDataAccess.GetCorridors(model);

            //if room has no saved exits
            if (exits == null || exits.Count == 0)
            {
                //save each exit
                foreach (var exit in room.Exits)
                {
                    if (exit != null)
                    {
                        await _gameDataAccess.AddCorridors(model, new Room { RoomID = exit.Id });
                    }
                }
            }
        }