public void RemoveItem(AdventureGameModelRoomInventoryKey item) { var list = new List <AdventureGameModelRoomInventoryKey>(Item); list.Remove(item); Item = list.ToArray(); }
public void AddItem(AdventureGameModelRoomInventoryKey item) { Item = new List <AdventureGameModelRoomInventoryKey>(Item) { item }.ToArray(); }
private static AdventureGameModelPlayerInventoryKey[] AddKey(AdventureGameModelRoomInventoryKey item) { var keys = new List <AdventureGameModelPlayerInventoryKey>(); var existingItems = _gameModel.Player.Inventory.Item; if (existingItems != null) { keys.AddRange(existingItems); } keys.Add(new AdventureGameModelPlayerInventoryKey() { Color = item.Color }); var array = keys.ToArray(); return(array); }
private static void Drop(string command) { var color = command.Split(' ')[1]; var items = _gameModel.Player.Inventory.Item; var item = GetItemForDrop(command, items); Console.Clear(); if (item == null) { Console.Clear(); Console.WriteLine("Du har ingen " + color + " nøkkel"); return; } _gameModel.Player.Inventory.RemoveItem(item); var room = GetCurrentRoom(); var newRoomItem = new AdventureGameModelRoomInventoryKey { Color = item.Color }; room.Inventory.AddItem(newRoomItem); }