Exemplo n.º 1
0
        public KeyValuePair <string, NounObject>?FindObject(NounObject input, out bool isInInventory,
                                                            bool includeInventory = false)
        {
            if (includeInventory)
            {
                foreach (var nounObject in _gameState.inventory.objMap)
                {
                    if (nounObject.Value.myKey == input.myKey)
                    {
                        isInInventory = true;
                        return(nounObject);
                    }
                }
            }
            else
            {
                isInInventory = false;
                foreach (var nounObject in _gameState.currentRoom().allNounsInScene)
                {
                    if (nounObject.Value.myKey == input.myKey)
                    {
                        return(nounObject);
                    }
                }
            }
            isInInventory = false;

            return(null);
        }
 public void AddItem(string name, NounObject obj)
 {
     objMap.Add(name, obj);
 }
Exemplo n.º 3
0
 public Room RegisterNounInScene(string name, NounObject obj)
 {
     allNounsInScene.Add(name, obj);
     obj.myKey = name;
     return(this);
 }
Exemplo n.º 4
0
 public Room AddNounChild(string name, string objname, NounObject obj)
 {
     Children[name].nounChildren.Add(objname, obj);
     RegisterNounInScene(objname, obj);
     return(this);
 }
Exemplo n.º 5
0
 public Room AddNoun(string name, NounObject obj)
 {
     Children.Add(name, obj);
     RegisterNounInScene(name, obj);
     return(this);
 }
Exemplo n.º 6
0
        public void RemoveObject(NounObject input)
        {
            bool isinInv;

            RemoveObject(FindObject(input, out isinInv, true).Value.Key);
        }