1
0
Fork 0

Fixed move animation being done as background when coming from an action

This commit is contained in:
Michaël Lemaire 2018-04-04 23:15:14 +02:00
parent c3268ebdea
commit 5f0732b39b

View file

@ -254,15 +254,18 @@ module TK.SpaceTac.UI {
return {};
}
} else if (diff instanceof ShipMoveDiff) {
return {
background: async (animate: boolean, timer: Timer) => {
this.moveTo(diff.start.x, diff.start.y, diff.start.angle, false);
let duration = this.moveTo(diff.end.x, diff.end.y, diff.end.angle, animate, !!diff.engine);
if (duration && animate) {
await timer.sleep(duration);
}
let func = async (animate: boolean, timer: Timer) => {
this.moveTo(diff.start.x, diff.start.y, diff.start.angle, false);
let duration = this.moveTo(diff.end.x, diff.end.y, diff.end.angle, animate, !!diff.engine);
if (duration && animate) {
await timer.sleep(duration);
}
};
if (diff.engine) {
return { foreground: func };
} else {
return { background: func };
}
} else if (diff instanceof VigilanceAppliedDiff) {
let action = this.ship.actions.getById(diff.action);
return {