示例#1
0
        public CeilingContainer(Inventory parentInventory) : base(parentInventory: parentInventory)
        {
            Noun = new GNoun("plafond", Genre.masuclin);

            GenreSynonyms = new Genre[] { Genre.masuclin };

            sayOnTryToGo = "Mais bien sûr...";

            HasUnderContainer = true;
            underInventory    = new UnderInventory(this);
        }
示例#2
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);
            }
        }
示例#3
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);
        }