Add basic gameobject system

This commit is contained in:
schmelczerandras 2020-07-19 13:50:03 +02:00
parent d5be727040
commit efb01476b2
33 changed files with 399 additions and 171 deletions

View file

@ -1,3 +1,6 @@
import { Typed } from '../transport/serializable';
import { Id } from '../identity/identity';
export abstract class Command extends Typed {}
export abstract class Command extends Typed {
target?: Id;
}

View file

@ -0,0 +1,8 @@
import { Drawer } from '../../drawing/drawer';
import { Command } from '../command';
export class DrawCommand extends Command {
public constructor(public readonly drawer?: Drawer) {
super();
}
}

View file

@ -1,7 +1,7 @@
import { Command } from '../command';
export class KeyDownCommand extends Command {
public constructor(public readonly key: string) {
public constructor(public readonly key?: string) {
super();
}
}

View file

@ -1,7 +1,7 @@
import { Command } from '../command';
export class KeyUpCommand extends Command {
public constructor(public readonly key: string) {
public constructor(public readonly key?: string) {
super();
}
}

View file

@ -0,0 +1,9 @@
import { Drawer } from '../../drawing/drawer';
import { Command } from '../command';
import { Vec2 } from '../../math/vec2';
export class MoveToCommand extends Command {
public constructor(public readonly position?: Vec2) {
super();
}
}

View file

@ -2,7 +2,7 @@ import { Command } from '../command';
import { Vec2 } from '../../math/vec2';
export class PrimaryActionCommand extends Command {
public constructor(public readonly position: Vec2) {
public constructor(public readonly position?: Vec2) {
super();
}
}

View file

@ -2,7 +2,7 @@ import { Command } from '../command';
import { Vec2 } from '../../math/vec2';
export class SecondaryActionCommand extends Command {
public constructor(public readonly position: Vec2) {
public constructor(public readonly position?: Vec2) {
super();
}
}

View file

@ -0,0 +1,9 @@
import { Command } from '../command';
export class StepCommand extends Command {
public constructor(
public readonly deltaTimeInMiliseconds?: DOMHighResTimeStamp
) {
super();
}
}

View file

@ -2,7 +2,7 @@ import { Command } from '../command';
import { Vec2 } from '../../math/vec2';
export class SwipeCommand extends Command {
public constructor(public readonly delta: Vec2) {
public constructor(public readonly delta?: Vec2) {
super();
}
}