reworked Mark function to handle Clear function, fixed Goal class to adjusted address format, added shufflecellsfunction
This commit is contained in:
@@ -20,7 +20,7 @@ public partial class Actor : Sprite2D
|
||||
|
||||
// CALLABLE ACTIONS
|
||||
|
||||
public bool RotateCells(int ROTATIONS = 1, bool JUST_MARKS = false)
|
||||
public bool RotateCells(int ROTATIONS = 1)
|
||||
{
|
||||
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
|
||||
List<int> addresses = new(_board._cells.Select(c=>c._address).ToList());
|
||||
@@ -54,6 +54,18 @@ public partial class Actor : Sprite2D
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ShuffleCells()
|
||||
{
|
||||
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
|
||||
Globals.Shuffle(positions);
|
||||
for (int i = 0; i < _board._cells.Count; i++)
|
||||
{
|
||||
_board._cells[i].Position = positions[i];
|
||||
}
|
||||
_board.RenumberCells();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ShiftMarks(int COLUMNS = 0, int ROWS = 0)
|
||||
{
|
||||
List<Actor> markers = new(_board._cells.Select(c=>c._marker).ToList());
|
||||
@@ -73,31 +85,14 @@ public partial class Actor : Sprite2D
|
||||
if (_board._cells[fromI]._marker != null)
|
||||
{
|
||||
_board._cells[toI].Mark(_board._cells[fromI]._marker);
|
||||
_board._cells[fromI].Clear();
|
||||
_board._cells[fromI].Mark();
|
||||
}
|
||||
else
|
||||
{
|
||||
_board._cells[toI].Clear();
|
||||
_board._cells[toI].Mark();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// int actualIndex =
|
||||
// int cellCol = i % 3;
|
||||
// int cellRow = (int)Math.Floor(i / 3f);
|
||||
// int newCol = cellCol + COLUMNS;
|
||||
// int newRow = cellRow + ROWS;
|
||||
// if (newCol >= 0 && newRow >= 0 && newCol <= 2 && newRow <= 2)
|
||||
// {
|
||||
// int newAddress = newRow*3 + newCol;
|
||||
// GD.Print(i, cellCol, cellRow, newCol, newRow, newAddress);
|
||||
// if (_board._cells[i]._marker != null)
|
||||
// {
|
||||
// _board._cells[newAddress].Mark(_board._cells[i]._marker);
|
||||
// }
|
||||
// // _board._cells[i].Clear();
|
||||
// }
|
||||
}
|
||||
_board.RenumberCells();
|
||||
|
||||
@@ -150,10 +145,6 @@ public partial class Actor : Sprite2D
|
||||
|
||||
//MoveMark
|
||||
|
||||
//ShiftColumns
|
||||
|
||||
//ShiftRows
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user