Add basic gameobject system
This commit is contained in:
parent
d5be727040
commit
efb01476b2
33 changed files with 399 additions and 171 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
8
frontend/src/scripts/commands/types/draw.ts
Normal file
8
frontend/src/scripts/commands/types/draw.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9
frontend/src/scripts/commands/types/move-to.ts
Normal file
9
frontend/src/scripts/commands/types/move-to.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9
frontend/src/scripts/commands/types/step.ts
Normal file
9
frontend/src/scripts/commands/types/step.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Command } from '../command';
|
||||
|
||||
export class StepCommand extends Command {
|
||||
public constructor(
|
||||
public readonly deltaTimeInMiliseconds?: DOMHighResTimeStamp
|
||||
) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue