Fix bugs.

pull/3/head
jacky_cai 2022-03-15 23:21:32 -07:00
parent b791f0f5d2
commit 85b64b455f
2 changed files with 10 additions and 3 deletions

View File

@ -196,6 +196,7 @@ public class Unit : MonoBehaviour
else
{
// Can't move to cell this is standed by enemy.
destinationCell = standingCell;
break;
}
}
@ -273,7 +274,7 @@ public class Unit : MonoBehaviour
for (int i = 0; i < unitsInRange.Count; i++)
{
Debug.Log(unitsInRange[i].unitName + ": " + unitsInRange[i].standingCell.xPos + " , " + unitsInRange[i].standingCell.yPos);
//Debug.Log(unitsInRange[i].unitName + ": " + unitsInRange[i].standingCell.xPos + " , " + unitsInRange[i].standingCell.yPos);
// Do attack
//Debug.Log("Attack!");
unitsInRange[i].currentDefense -= finalAttack;

View File

@ -55,7 +55,10 @@ public class UnitManager : MonoBehaviour
{
unit.MoveAction();
}
}
foreach (var unit in rightSideUnits)
{
if (unit.isUnitAlive())
{
unit.AttackAction();
@ -71,7 +74,10 @@ public class UnitManager : MonoBehaviour
{
unit.MoveAction();
}
}
foreach (var unit in leftSideUnits)
{
if (unit.isUnitAlive())
{
unit.AttackAction();
@ -87,10 +93,10 @@ public class UnitManager : MonoBehaviour
switch (side)
{
case Side.left:
leftSideUnits = leftSideUnits.OrderByDescending(x => x.standingCell.xPos).ThenByDescending(y => y.standingCell.yPos).ToList<Unit>();
leftSideUnits = leftSideUnits.OrderByDescending(x => x.standingCell.xPos).ThenBy(y => y.standingCell.yPos).ToList<Unit>();
break;
case Side.right:
rightSideUnits = rightSideUnits.OrderBy(x => x.standingCell.xPos).ThenBy(y => y.standingCell.yPos).ToList<Unit>();
rightSideUnits = rightSideUnits.OrderBy(x => x.standingCell.xPos).ThenByDescending(y => y.standingCell.yPos).ToList<Unit>();
break;
default:
break;