Tuesday, 16 September 2025 22:07:13
This commit is contained in:
@@ -13,9 +13,6 @@ public partial class Desk : Node2D
|
||||
_grid = GetNode<Node2D>("Cells");
|
||||
_light = GetNode<Cell>("Light");
|
||||
_dark = GetNode<Cell>("Dark");
|
||||
|
||||
_cellDimensions = new Vector2(50, 50);
|
||||
|
||||
}
|
||||
|
||||
public Cell GetCellFromAddress(int ROW, int COLUMN)
|
||||
@@ -43,9 +40,13 @@ public partial class Desk : Node2D
|
||||
return new Vector2(-1, -1);
|
||||
}
|
||||
|
||||
public void Setup(int ROWS, int COLUMNS)
|
||||
public void Setup(int ROWS, int COLUMNS, int CELLSIZE)
|
||||
{
|
||||
_gridDimensions = new Vector2(COLUMNS, ROWS);
|
||||
_cellDimensions = new Vector2(CELLSIZE, CELLSIZE);
|
||||
_light.Scale = _cellDimensions / _light.Texture.GetSize();
|
||||
_dark.Scale = _cellDimensions / _dark.Texture.GetSize();
|
||||
|
||||
_topLeft = Globals.Instance._screenCenter - _cellDimensions * _gridDimensions / 2 + _cellDimensions / 2;
|
||||
Vector2 position;
|
||||
Node2D row;
|
||||
@@ -62,6 +63,7 @@ public partial class Desk : Node2D
|
||||
{
|
||||
position = _topLeft + new Vector2(_cellDimensions.X * j, _cellDimensions.Y * i);
|
||||
column = (Cell)((i + j) % 2 == 0 ? _light : _dark).Duplicate();
|
||||
column._size = (int)(column.Texture.GetSize().Y * column.Scale.Y);
|
||||
column.Name = "C" + (j + 1);
|
||||
column.GlobalPosition = position;
|
||||
column.Visible = true;
|
||||
|
||||
Reference in New Issue
Block a user