@victor_monakhov/tanks
Version:
Game Tanks for browser
52 lines (42 loc) • 1.18 kB
TypeScript
declare module '@victor_monakhov/tanks' {
export const ETeamNames: Readonly<{
Red: 'red';
Blue: 'blue';
Green: 'green';
}>;
export type ETeamNames = (typeof ETeamNames)[keyof typeof ETeamNames];
export const EUnitStatus: Readonly<{
InWar: 'inWar',
Winner: 'winner',
Defeated: 'defeated',
}>;
export type EUnitStatus = (typeof EUnitStatus)[keyof typeof EUnitStatus];
export class GameSettings {
playerName: string;
position: number;
team: string;
tankHead: string;
tankBody: string;
}
export class TankStats {
tankHead: string;
tankBody: string;
name: string;
team: ETeamNames;
level: number;
kills: number;
deaths: number;
date: number;
}
export class GameState {
gameStatus: EUnitStatus;
player: TankStats;
bots: TankStats[];
}
export class Game {
constructor(canvas: HTMLCanvasElement, settings: GameSettings);
run(): void;
stateObserver(subscriber: (state: GameState) => void): void;
destroy(): void;
}
}