This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path类图.pu
87 lines (84 loc) · 2.43 KB
/
类图.pu
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@startuml 类图
class GameBase{
{field} public context: CanvasRenderingContext2D
{field} private readonly keydownEvent: (e: KeyboardEvent) => void
{method} public draw(): void
{method} private addGroundObjects(x: WhereIndex, y: WhereIndex, typeCode: 1 | 2 | 3)
{method} public gameStart(): void
{method} public gamePauses(): void
{method} public drawSVG(svg: HTMLCanvasElement, x: number, y: number, svgSize: number): void
}
abstract class Obstacles {
public x: WhereIndex;
public y: WhereIndex;
public {abstract} draw(context: CanvasRenderingContext2D): void;
public {abstract} gunShoot(gameBase: GameBase): void;
}
class IronWall{
draw(context: CanvasRenderingContext2D): void
gunShoot(): void
}
class BrickWall{
draw(context: CanvasRenderingContext2D): void
gunShoot(): void
}
class Plain{
draw(context: CanvasRenderingContext2D): void
gunShoot(): void
}
abstract class Tanks {
public x: WhereIndex;
public y: WhereIndex;
public readonly color: string;
public deg: Deg;
private allowTranslate: boolean;
protected lifeValue: 0 | 1 | 2 | 3;
protected movementSpe: 100 | 200 | 150;
public draw(deg: Deg | undefined): void
public move(x: 1 | 0 | -1, y: 1 | 0 | -1): boolean
public fire(): void
public {abstract} gunShoot(bullet: Bullet): boolean;
public {abstract} changeGameBase(): undefined;
}
class PlayerTanks {
public bullet: PlayerBullet | null;
public gunShoot(bullet: Bullet): boolean
changeGameBase(): undefined;
}
class EnemyTanks {
public bullet: EnemyBullet | null;
public gunShoot(bullet: Bullet): boolean
changeGameBase(): undefined;
}
abstract class Bullet {
public x: WhereIndex;
public y: WhereIndex;
public deg: Deg;
private intervalId: number | null;
protected constructor(x: WhereIndex, y: WhereIndex, deg: Deg)
init(): void
move(): void
public draw(): void
}
class PlayerBullet {
}
class EnemyBullet {
}
GameBase o-- Obstacles
Tanks o-- GameBase
GameBase o-- PlayerTanks
GameBase o-- EnemyTanks
Bullet o-- Tanks
Tanks o--Bullet
EnemyTanks o-- EnemyBullet
EnemyBullet o--EnemyTanks
PlayerTanks o--PlayerBullet
PlayerBullet o-- PlayerTanks
Obstacles <|-- IronWall
Obstacles <|-- BrickWall
Obstacles <|-- Plain
Tanks <|-- PlayerTanks
Tanks <|-- EnemyTanks
Bullet <|-- PlayerBullet
Bullet <|-- EnemyBullet
@enduml