1
0
Fork 0
spacetac/src/core/events/MoveEvent.ts

37 lines
941 B
TypeScript
Raw Normal View History

/// <reference path="BaseBattleEvent.ts"/>
2015-02-09 00:00:00 +00:00
2017-02-09 00:00:35 +00:00
module TS.SpaceTac {
/**
* Event making a ship move
*/
export class MoveEvent extends BaseLogShipEvent {
// Previous location
start: ArenaLocationAngle
2017-05-25 23:09:29 +00:00
// New location
end: ArenaLocationAngle
2015-01-26 00:00:00 +00:00
// Engine used
engine: Equipment | null
constructor(ship: Ship, start: ArenaLocationAngle, end: ArenaLocationAngle, engine: Equipment | null = null) {
super("move", ship, Target.newFromLocation(end.x, end.y));
2015-01-26 00:00:00 +00:00
this.start = start;
this.end = end;
this.engine = engine;
}
getReverse(): BaseBattleEvent {
return new MoveEvent(this.ship, this.end, this.start, this.engine);
}
/**
* Get the distance travelled
*/
getDistance(): number {
return arenaDistance(this.start, this.end);
2014-12-31 00:00:00 +00:00
}
}
2015-01-07 00:00:00 +00:00
}