Update gameplay

This commit is contained in:
schmelczerandras 2020-10-23 15:19:04 +02:00
parent 49c410d8ff
commit 23fa7646d6
10 changed files with 165 additions and 33 deletions

View file

@ -0,0 +1,37 @@
import { vec2 } from 'gl-matrix';
import { CharacterTeam } from '../../objects/types/character-team';
import { serializable } from '../../transport/serialization/serializable';
import { Command } from '../command';
@serializable
export class OtherPlayerDirection {
public constructor(
public readonly direction: vec2,
public readonly team: CharacterTeam,
) {}
public toArray(): Array<any> {
return [this.direction, this.team];
}
}
@serializable
export class UpdateGameState extends Command {
public constructor(
public readonly declaCount: number,
public readonly redCount: number,
public readonly neutralCount: number,
public readonly otherPlayerDirections: Array<OtherPlayerDirection>,
) {
super();
}
public toArray(): Array<any> {
return [
this.declaCount,
this.redCount,
this.neutralCount,
this.otherPlayerDirections,
];
}
}

View file

@ -1,17 +0,0 @@
import { serializable } from '../../transport/serialization/serializable';
import { Command } from '../command';
@serializable
export class UpdatePlanetOwnershipCommand extends Command {
public constructor(
public readonly declaCount: number,
public readonly redCount: number,
public readonly neutralCount: number,
) {
super();
}
public toArray(): Array<any> {
return [this.declaCount, this.redCount, this.neutralCount];
}
}

View file

@ -7,9 +7,10 @@ export * from './commands/types/move-action';
export * from './commands/types/primary-action';
export * from './commands/types/player-died';
export * from './commands/types/update-objects';
export * from './commands/types/update-planet-ownership';
export * from './commands/types/update-game-state';
export * from './commands/types/secondary-action';
export * from './commands/command-receiver';
export * from './commands/types/update-game-state';
export * from './commands/command-executors';
export * from './commands/command-generator';
export * from './commands/broadcast-commands';
@ -45,7 +46,6 @@ export * from './objects/types/player-character-base';
export * from './objects/types/lamp-base';
export * from './objects/types/planet-base';
export * from './objects/types/projectile-base';
export * from './objects/update-message';
export * from './objects/update-object-message';
export * from './settings';
export * from './transport/transport-events';