Ejemplo n.º 1
0
        /**
         *  Factory for building the InventoryGUI
         *
         *  @param GameObject parent The parent game object to attach
         *      the GUI window to
         *  @param Inventory inventory The inventory
         *  @param Vector2 itemOffset The x, y offset of the items displaying
         *      in the GUI window
         *  @param int tilesize The size of the tiles (they're square)
         *  @param Rect windowSize The size of the GUI Window
         *
         **/
        public static InventoryGUI CreateComponent(GameObject parent, Inventory inventory, Vector2 itemOffset, int tilesize, Rect windowSize, Rect draggableArea)
        {
            InventoryGUI inventoryGUI = parent.AddComponent <InventoryGUI>();

            inventoryGUI.itemOffset    = itemOffset;
            inventoryGUI.tilesize      = tilesize;
            inventoryGUI.windowRect    = windowSize;
            inventoryGUI.draggableArea = draggableArea;
            inventoryGUI.Hide();

            return(inventoryGUI);
        }
Ejemplo n.º 2
0
 public void Start()
 {
     inventory    = new GameObject[(int)inventorySize.x, (int)inventorySize.y];
     parent       = GameObjectFactory.NewGameObject(parentName, gameObject.transform);
     inventoryGUI = InventoryGUI.CreateComponent(parent, this, itemOffset, tilesize, guiSize, draggableArea);
 }