1
0
Fork 0
spacetac/src/scripts/game/Fleet.ts

34 lines
758 B
TypeScript
Raw Normal View History

2014-12-29 00:00:00 +00:00
module SpaceTac.Game {
2015-01-07 00:00:00 +00:00
"use strict";
2014-12-29 00:00:00 +00:00
// A fleet of ships
export class Fleet {
// Fleet owner
player: Player;
// List of ships
ships: Ship[];
2015-01-19 00:00:00 +00:00
// Current battle in which the fleet is engaged (null if not fighting)
battle: Battle;
2014-12-29 00:00:00 +00:00
// Create a fleet, bound to a player
constructor(player: Player) {
this.player = player;
this.ships = [];
2015-01-19 00:00:00 +00:00
this.battle = null;
}
// Add a ship in this fleet
addShip(ship: Ship): void {
ship.fleet = this;
this.ships.push(ship);
2014-12-29 00:00:00 +00:00
}
2015-01-19 00:00:00 +00:00
// Set the current battle
setBattle(battle: Battle): void {
this.battle = battle;
}
2014-12-29 00:00:00 +00:00
}
2015-01-07 00:00:00 +00:00
}