示例#1
0
    public virtual void PlaceInWorld(FurnitureManager fm)
    {
        if (fm == null)
        {
            return;
        }

        bool worked = fm.PlaceFurniture(Prefab, X, Y);

        if (!worked)
        {
            Debug.LogError("Failed to place '" + Prefab + "'! Data may be lost!");
        }
        else
        {
            Furniture f = fm.GetFurnitureAt(X, Y);
            if (f != null)
            {
                ApplyData(f);
            }
            else
            {
                Debug.LogError("Placed furniture '" + Prefab + "' at " + X + ", " + Y + " but requesting the placed object failed! Might result in data loss for placed furniture.");
            }
        }
    }
示例#2
0
    private void ReadXml_Furnitures(XmlReader reader)
    {
        if (reader.ReadToDescendant("Furniture"))
        {
            do
            {
                int   x        = int.Parse(reader.GetAttribute("X"));
                int   y        = int.Parse(reader.GetAttribute("Y"));
                int   z        = int.Parse(reader.GetAttribute("Z"));
                float rotation = float.Parse(reader.GetAttribute("Rotation"));

                Furniture furniture = FurnitureManager.PlaceFurniture(reader.GetAttribute("type"), tiles[x, y, z], false, rotation);
                furniture.ReadXml(reader);
            }while (reader.ReadToNextSibling("Furniture"));
        }
    }