Esempio n. 1
0
        public WallContainer(Inventory parentInventory) : base(parentInventory: parentInventory)
        {
            Noun = new GNoun("mur", Genre.masuclin);


            sayOnTryToGo = "Oui de fait, je pense que vous allez dans le mur...";

            HasAboveContainer = true;
            aboveInventory    = new OnInventory(this);
        }
Esempio n. 2
0
        public FloorContainer(Inventory parentInventory) : base(parentInventory: parentInventory)
        {
            //Synonyms = new string[]     {"sol"              };
            Noun = new GNoun("sol", Genre.masuclin);


            sayOnTryToGo = "Vous compter creuser??";

            HasAboveContainer = true;
            aboveInventory    = new OnInventory(this);
        }
Esempio n. 3
0
 public void CreateInventories()
 {
     if (HasAboveContainer && aboveInventory == null)
     {
         aboveInventory = new OnInventory(this);
     }
     if (HasInsideContainer && insideInventory == null)
     {
         insideInventory = new InsideInventory(this);
     }
     if (HasUnderContainer && underInventory == null)
     {
         underInventory = new UnderInventory(this);
     }
 }
Esempio n. 4
0
        private static Inventory copyThisInventory(bool hasInventory, Inventory inventoryToCopy, Oobject copyiedObjectParent, Oobject objReference)
        {
            if (hasInventory)
            {
                Inventory copyiedInventory = null;

                if (inventoryToCopy is OnInventory)
                {
                    copyiedInventory = new OnInventory(copyiedObjectParent);
                }
                else if (inventoryToCopy is UnderInventory)
                {
                    copyiedInventory = new UnderInventory(copyiedObjectParent);
                }
                else
                {
                    copyiedInventory = new InsideInventory(copyiedObjectParent);
                }

                if (inventoryToCopy == null)
                {
                    return(copyiedInventory);
                }
                foreach (var realObj in inventoryToCopy.objects)
                {
                    Oobject childObjectCopy = Oobject.CopyObject(realObj, copyiedInventory);
                    copyInventories(childObjectCopy, realObj);
                    copyiedInventory.Add(childObjectCopy);
                }
                return(copyiedInventory);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
        private Inventory loadInventory(string inventoryType, XElement inventory, Oobject parentObj, Inventory parentInventory)
        {
            Inventory inventoryToAdd = null;

            if (inventoryType == "On")
            {
                inventoryToAdd = new OnInventory(parentObj);
            }
            if (inventoryType == "Inside")
            {
                inventoryToAdd = new InsideInventory(parentObj);
            }
            if (inventoryType == "Under")
            {
                inventoryToAdd = new UnderInventory(parentObj);
            }

            //List<Oobject> objects = new List<Oobject>();
            foreach (XElement obj in inventory.Elements("Object"))
            {
                Oobject objectToAdd;
                if (obj.Attribute("Type").Value == Oobject.AccessPointObjectType)
                {
                    objectToAdd = new AccessPointObject(parentInventory);
                    AccessPointObject apObj = (AccessPointObject)objectToAdd;
                    apObj.Direction = obj.Element("Direction").Value;
                }

                else if (obj.Attribute("Type").Value == Oobject.FloorObjectType)
                {
                    objectToAdd = new FloorContainer(parentInventory);
                }

                else if (obj.Attribute("Type").Value == Oobject.WallObjectType)
                {
                    objectToAdd = new WallContainer(parentInventory);
                }

                else if (obj.Attribute("Type").Value == Oobject.CeilingObjectType)
                {
                    objectToAdd = new CeilingContainer(parentInventory);
                }

                else
                {
                    objectToAdd = new SolidObject(parentInventory);
                }
                objectToAdd.Id            = Int32.Parse(obj.Attribute("Id").Value);
                objectToAdd.Noun.Singular = obj.Attribute("Name").Value;

                foreach (XElement elementInventory in obj.Elements("Inventory"))
                {
                    if (elementInventory.Attribute("Type").Value == "On")
                    {
                        objectToAdd.aboveInventory = loadInventory("On", elementInventory, objectToAdd, inventoryToAdd);

                        objectToAdd.HasAboveContainer = true;
                    }
                    else if (elementInventory.Attribute("Type").Value == "Under")
                    {
                        objectToAdd.underInventory = loadInventory("Under", elementInventory, objectToAdd, inventoryToAdd);

                        objectToAdd.HasUnderContainer = true;
                    }
                    else
                    {
                        objectToAdd.insideInventory = loadInventory("Inside", elementInventory, objectToAdd, inventoryToAdd);

                        objectToAdd.HasInsideContainer = true;
                    }
                }
                inventoryToAdd.Add(objectToAdd);
            }
            return(inventoryToAdd);
        }