Example #1
0
 private void HighlightGrid(Grid grid, GridHighlight highlightType)
 {
     for (var i = 0; i < grid.Size.Width; i++)
     {
         for (var j = 0; j < grid.Size.Height; j++)
         {
             if (grid.Weight[i, j] > 0)
             {
                 HighlightCell(i, j, highlightType);
             }
         }
     }
 }
Example #2
0
        private void HighlightCell(int x, int y, GridHighlight type)
        {
            if (x < 0 || x >= _grid.Size.Width || y < 0 || y >= _grid.Size.Height)
            {
                return;
            }
            if (_gridCells[x, y] == null)
            {
                return;
            }

            _gridCells[x, y].Highlight = type;
        }
Example #3
0
    void Start()
    {
        grid      = GetComponent <RectTransform>();
        hover     = new GridHighlight(this);
        objects   = new Dictionary <OccupiedSlot, Highlight>();
        GRID_SIZE = (grid.rect.width - inventory.WIDTH - 1) / inventory.WIDTH;

        foreach (OccupiedSlot slot in inventory.items)
        {
            AddItem(slot);
        }
        inventory.OnItemAdded.AddListener(AddItem);
        inventory.OnItemRemoved.AddListener(RemoveItem);
    }
Example #4
0
 private void HighlightGrid(Grid grid, GridHighlight highlightType)
 {
     for (var i = 0; i < grid.Size.Width; i++)
     {
         for (var j = 0; j < grid.Size.Height; j++)
         {
             if (grid.Weight[i, j] > 0)
             {
                 HighlightCell(i, j, highlightType);
             }
         }
     }
 }
Example #5
0
        private void HighlightCell(int x, int y, GridHighlight type)
        {
            if (x < 0 || x >= _grid.Size.Width || y < 0 || y >= _grid.Size.Height) return;
            if (_gridCells[x, y] == null) return;

            _gridCells[x, y].Highlight = type;
        }