Fix bugs.
parent
b791f0f5d2
commit
85b64b455f
|
@ -196,6 +196,7 @@ public class Unit : MonoBehaviour
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Can't move to cell this is standed by enemy.
|
// Can't move to cell this is standed by enemy.
|
||||||
|
destinationCell = standingCell;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,7 +274,7 @@ public class Unit : MonoBehaviour
|
||||||
|
|
||||||
for (int i = 0; i < unitsInRange.Count; i++)
|
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
|
// Do attack
|
||||||
//Debug.Log("Attack!");
|
//Debug.Log("Attack!");
|
||||||
unitsInRange[i].currentDefense -= finalAttack;
|
unitsInRange[i].currentDefense -= finalAttack;
|
||||||
|
|
|
@ -55,7 +55,10 @@ public class UnitManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
unit.MoveAction();
|
unit.MoveAction();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var unit in rightSideUnits)
|
||||||
|
{
|
||||||
if (unit.isUnitAlive())
|
if (unit.isUnitAlive())
|
||||||
{
|
{
|
||||||
unit.AttackAction();
|
unit.AttackAction();
|
||||||
|
@ -71,7 +74,10 @@ public class UnitManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
unit.MoveAction();
|
unit.MoveAction();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var unit in leftSideUnits)
|
||||||
|
{
|
||||||
if (unit.isUnitAlive())
|
if (unit.isUnitAlive())
|
||||||
{
|
{
|
||||||
unit.AttackAction();
|
unit.AttackAction();
|
||||||
|
@ -87,10 +93,10 @@ public class UnitManager : MonoBehaviour
|
||||||
switch (side)
|
switch (side)
|
||||||
{
|
{
|
||||||
case Side.left:
|
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;
|
break;
|
||||||
case Side.right:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue