-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype.ts
55 lines (50 loc) · 1.11 KB
/
type.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
enum RawTile {
AIR,
FLUX,
UNBREAKABLE,
PLAYER,
STONE, FALLING_STONE,
BOX, FALLING_BOX,
KEY1, LOCK1,
KEY2, LOCK2
}
// enum FallingState {
// FALLING, RESTING
// }
interface FallingState {
isFalling(): boolean;
isResting(): boolean;
moveHorizontal(tile: Tile, dx: number): void;
boxMoveHorizontal(dx: number): void;
}
interface Input {
isRight(): boolean;
isLeft(): boolean;
isUp(): boolean;
isDown(): boolean;
handle(): void;
}
interface RemoveStrategy {
check(tile:Tile): boolean;
}
interface Tile {
isFlux(): boolean;
isUnbreakable(): boolean;
isAir(): boolean;
isPlayer(): boolean;
isKey1(): boolean;
isLock1(): boolean;
isKey2(): boolean;
isLock2(): boolean;
color(g: CanvasRenderingContext2D): void;
draw(g: CanvasRenderingContext2D, x:number, y:number): void;
isEdible(): boolean;
isPushable(): boolean;
moveHorizontal(dx: number): void;
moveVertical(dy: number): void;
drop(): void;
rest(): void;
isFalling(): boolean;
canFall(): boolean;
update(x: number, y: number): void;
}