Simplify types
This commit is contained in:
parent
6eddb4834b
commit
ba8b1a29fd
4 changed files with 52 additions and 76 deletions
|
|
@ -2,8 +2,12 @@ import { CommandReceiver } from '../commands/command-receiver';
|
|||
import { Id } from '../transport/identity';
|
||||
|
||||
export abstract class GameObject extends CommandReceiver {
|
||||
public static get type(): string {
|
||||
return (this as any).name;
|
||||
}
|
||||
|
||||
public get type(): string {
|
||||
return (this as any).constructor.type;
|
||||
return (this as any).constructor.name;
|
||||
}
|
||||
|
||||
constructor(public readonly id: Id) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Circle } from '../../helper/circle';
|
||||
import { Id } from '../../main';
|
||||
import { GameObject } from '../game-object';
|
||||
|
||||
export abstract class CharacterBase extends GameObject {
|
||||
public static readonly type = 'Character';
|
||||
|
||||
constructor(
|
||||
id: Id,
|
||||
public head: Circle,
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ import { Id } from '../../main';
|
|||
import { GameObject } from '../game-object';
|
||||
|
||||
export abstract class LampBase extends GameObject {
|
||||
public static readonly type = 'Lamp';
|
||||
|
||||
constructor(id: Id, public center: vec2, public color: vec3, public lightness: number) {
|
||||
super(id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { GameObject, Id } from '../../main';
|
||||
import { typed } from '../../transport/typed';
|
||||
|
||||
export abstract class TunnelBase extends GameObject {
|
||||
public static readonly type = 'Tunnel';
|
||||
|
||||
constructor(
|
||||
id: Id,
|
||||
public readonly from: vec2,
|
||||
|
|
|
|||
Loading…
Reference in a new issue