1
0
Fork 0
spacetac/src/app/game/StarLocation.ts

47 lines
1.1 KiB
TypeScript
Raw Normal View History

2015-03-24 00:00:00 +00:00
/// <reference path="Serializable.ts"/>
module SpaceTac.Game {
"use strict";
export enum StarLocationType {
STAR,
WARP,
PLANET,
ASTEROID,
STATION
}
// Point of interest in a star system
export class StarLocation extends Serializable {
// Parent star system
star: Star;
// Type of location
type: StarLocationType;
// Location in the star system
x: number;
y: number;
// Destination for jump, if its a WARP location
jump_dest: StarLocation;
2015-03-24 00:00:00 +00:00
constructor(star: Star, type: StarLocationType, x: number, y: number) {
super();
this.star = star;
this.type = type;
this.x = x;
this.y = y;
this.jump_dest = null;
}
// Set the jump destination of a WARP location
setJumpDestination(jump_dest: StarLocation): void {
if (this.type === StarLocationType.WARP) {
this.jump_dest = jump_dest;
}
2015-03-24 00:00:00 +00:00
}
}
}