Beispiel #1
0
 /// <summary>
 /// Sets the value of a gridcell
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="value"></param>
 public void SetValue(int x, int y, TGridObject value)
 {
     if (IsInBounds(x, y))
     {
         _cells[x, y] = value;
         OnCellChanged?.Invoke(new GridCellChangedEventArgs()
         {
             X = x, Y = y, Value = value
         });
     }
 }
Beispiel #2
0
        /// <summary>
        /// Sets the value of a gridcell
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="value"></param>
        public void SetValue(Vector3 worldPos, TGridObject value)
        {
            var p = World2Grid(worldPos);

            if (IsInBounds(p.x, p.y))
            {
                _cells[p.x, p.y] = value;
                OnCellChanged?.Invoke(new GridCellChangedEventArgs()
                {
                    X = p.x, Y = p.y, Value = value
                });
            }
        }
        public void SetCellNumber(int row, int col, int number)
        {
            _grid[row][col] = number;

            OnCellChanged?.Invoke(row, col);
        }