Simplify types
This commit is contained in:
parent
6eddb4834b
commit
ba8b1a29fd
30 changed files with 52 additions and 76 deletions
|
|
@ -2,8 +2,6 @@ import { vec2 } from 'gl-matrix';
|
|||
import { Command } from 'shared';
|
||||
|
||||
export class MoveToCommand extends Command {
|
||||
public static readonly type = 'MoveToCommand';
|
||||
|
||||
public constructor(public readonly position: vec2) {
|
||||
super();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import { Renderer } from 'sdf-2d';
|
|||
import { Command } from 'shared';
|
||||
|
||||
export class RenderCommand extends Command {
|
||||
public static readonly type = 'RenderCommand';
|
||||
|
||||
public constructor(public readonly renderer: Renderer) {
|
||||
super();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export const deserialize = (json: string): GameObject => {
|
|||
};
|
||||
|
||||
export const deserializeJsonArray = (json: string): Array<GameObject> => {
|
||||
return (JSON.parse(json) as Array<any>).map(
|
||||
([type, ...values]) => new constructors[type](...values)
|
||||
);
|
||||
return (JSON.parse(json) as Array<any>).map(([type, ...values]) => {
|
||||
return new constructors[type](...values);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue