void UnitsMoveToPosition(Vector3 movePosition, Unit[] units) { Vector3[] destinations = UnitMover.GetUnitGroupDestinations(movePosition, units.Length, 2); for (int x = 0; x < units.Length; x++) { units[x].MoveToPosition(destinations[x]); } }
void UnitsMoveToPosition(Vector3 movePos, Unit[] units) { Vector3[] destinations = UnitMover.GetUnitGroupDestinations(movePos, units.Length, 2); for (int i = 0; i < units.Length; i++) { units[i].MoveToPosition(destinations[i]); } }
// called when we command units to move somewhere void UnitsMoveToPosition(Vector3 movePos, Unit[] units) { // are just selecting 1 unit? if (units.Length == 1) { units[0].MoveToPosition(movePos); } // otherwise, calculate the unit group formation else { Vector3[] destinations = UnitMover.GetUnitGroupDestinations(movePos, units, 2); for (int x = 0; x < units.Length; x++) { units[x].MoveToPosition(destinations[x]); } } }