Fix some issues

This commit is contained in:
schmelczerandras 2020-11-03 23:40:14 +01:00
parent c0a588fb73
commit 1ce961d6c2
27 changed files with 432 additions and 200 deletions

View file

@ -1,3 +1,4 @@
import { Command } from '../commands/command';
import { Id } from '../transport/identity';
import { serializable } from '../transport/serialization/serializable';
@ -10,6 +11,39 @@ export class RemoteCall {
}
}
@serializable
export class UpdateProperty {
constructor(
public readonly propertyKey: string,
public readonly propertyValue: any,
public readonly rateOfChange: any,
) {}
public toArray(): Array<any> {
return [this.propertyKey, this.propertyValue, this.rateOfChange];
}
}
@serializable
export class PropertyUpdatesForObject {
constructor(public readonly id: Id, public readonly updates: Array<UpdateProperty>) {}
public toArray(): Array<any> {
return [this.id, this.updates];
}
}
@serializable
export class PropertyUpdatesForObjects extends Command {
constructor(public readonly updates: Array<PropertyUpdatesForObject>) {
super();
}
public toArray(): Array<any> {
return [this.updates];
}
}
export abstract class GameObject {
private remoteCalls: Array<RemoteCall> = [];
@ -23,6 +57,8 @@ export abstract class GameObject {
);
}
public getPropertyUpdates(): PropertyUpdatesForObject | void {}
public getRemoteCalls(): Array<RemoteCall> {
return this.remoteCalls;
}