Recode finished version 1

This commit is contained in:
firefighter198
2021-10-05 15:45:27 +02:00
parent af90d64644
commit cb3e7563a6
11 changed files with 9338 additions and 7758 deletions
+13 -15
View File
@@ -20,18 +20,18 @@ public class Knight : Character
new Vector2(-2, 1),
new Vector2(-2, -1),
};
public override bool[,] GetValidMoves(Cell[,] cells, Game game)
{
bool[,] result = new bool[8, 8];
foreach (Vector2 move in moves)
{
Vector3 testPosition = transform.position + (Vector3)move;
Cell testCell = game.GetCellOnPosition(testPosition + Vector3.back);
if(testCell != null)
if (testCell != null)
{
int x, y;
@@ -40,25 +40,23 @@ public class Knight : Character
x = int.Parse(nameX);
y = int.Parse(nameY);
if (IsPositionInGrid(x, y))
if (testCell.connected == null)
{
if (testCell.connected == null)
result[x, y] = true;
}
else
{
Character testCharacter = testCell.connected;
if (testCharacter.team != game.currentTeam)
{
result[x, y] = true;
}
else
{
Character testCharacter = testCell.connected;
if (testCharacter.team != game.currentTeam)
{
result[x, y] = true;
}
}
}
}
}
return result;
}
}
}