altering enemies into peg to open up for the future with hostile and friendly pegs. made some changes to the pathfinding. starting to add a mouse handler that will more easily handle single and double clicks, and holds. Enemy controller becomes peg controller and will handle all peg interactions
This commit is contained in:
@@ -12,7 +12,7 @@ public partial class Map : TileMapLayer
|
||||
public Vector2I _pathTakenAtlasCoordinates = new Vector2I(4, 0);
|
||||
public List<Vector2I> _cells = new(), _leftmostColumn = new(), _rightmostColumn = new(), _topRow = new(), _bottomRow = new();
|
||||
public AStarGrid2D _astar = new();
|
||||
public Dictionary<Vector2I, Enemy> _addressOccupants = new();
|
||||
public Dictionary<Vector2I, Peg> _addressOccupants = new();
|
||||
public int _firstOpenRow
|
||||
{
|
||||
get
|
||||
@@ -64,7 +64,7 @@ public partial class Map : TileMapLayer
|
||||
return GlobalPosition + CELL_ADDRESS * _cellSize + _cellSize / 2;
|
||||
}
|
||||
|
||||
public Enemy GetOccupant(Vector2I CELL_TO_CHECK)
|
||||
public Peg GetOccupant(Vector2I CELL_TO_CHECK)
|
||||
{
|
||||
return _addressOccupants[CELL_TO_CHECK];
|
||||
}
|
||||
@@ -90,20 +90,20 @@ public partial class Map : TileMapLayer
|
||||
return rowCells.All(c => _astar.IsPointSolid(c));
|
||||
}
|
||||
|
||||
public void SetCellEnemy(Vector2I ADDRESS, Enemy ENEMY)
|
||||
public void SetCellPeg(Vector2I ADDRESS, Peg PEG)
|
||||
{
|
||||
if (ENEMY != null)
|
||||
if (PEG != null)
|
||||
{
|
||||
if (ENEMY._address != -Vector2I.One)
|
||||
if (PEG._address != -Vector2I.One)
|
||||
{
|
||||
_addressOccupants[ENEMY._address] = null;
|
||||
SetCellSolid(ENEMY._address);
|
||||
_addressOccupants[PEG._address] = null;
|
||||
SetCellSolid(PEG._address);
|
||||
}
|
||||
ENEMY._address = ADDRESS;
|
||||
PEG._address = ADDRESS;
|
||||
}
|
||||
|
||||
|
||||
_addressOccupants[ADDRESS] = ENEMY;
|
||||
_addressOccupants[ADDRESS] = PEG;
|
||||
SetCellSolid(ADDRESS);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user