aboutsummaryrefslogtreecommitdiff
path: root/src/docs/class.puml
blob: 307110ccecedcdc341bdaee1ee5f7677ce68ab04 (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
@startuml

skinparam linetype ortho

package utils {
  class PathFinder {
    static List<Vec2> findPath(Board, TileVec2, TileVec2)
  }

  class TileVec2 {
    static final int TILE_DIM

    Vec2
    TileVec2(Vec2)
    Vec2 toPixelPos()
    static TileVec2 fromPixelPos(Vec2)
  }
}

package viewer {
  class Viewer {
    Game
    Stage
    void main(String[])
    void eventLoop(ApplicationContext)
    void renderFrame(Graphics2D)
  }
}

package context {
  class Context {
    Context(Stage,List<Event>,GraphicsContext)
    final Stage
    final List<Event>
    final GraphicsContext
  }

  class GraphicsContext {
    final Graphics2D
    final ScreenInfo
    paintCircle(Color, Vec2, int)
    paintSquare(Color, Vec2, int)
  }

  class InputHandler {
    private ApplicationContext
    InputHandler(ApplicationContext)
    List<Event> getEvents()
  }

  class ScreenManager {
    private ApplicationContext
    ScreenManager(ApplicationContext)
    GraphicsContext clearScreen()
  }

  class Game {
    final GameController
    final List<Board>
    Game(GameController,List<Board>)
  }
}

package event {
  interface Event

  class DropBombEvent implements Event {
    DropBombEvent(TileVec2)
  }

  class MoveRobotEvent implements Event {
    MoveRobotEvent(TileVec2)
  }

  class ConfirmEvent implements Event
}

package board {
  class Board {
    BlockType[][]
  }

  class BoardParser {
    static Board parse(File)
  }

  class BoardValidator {
    static bool validate(Board)
  }

  class BoardConverter {
    static Board worldToBoard(List<Block>)
    static List<Block> boardToWorld(Board)
  }
}

package model {
  enum BlockType {
    Wall
    Trash
    Garbage
    Robot
    Bomb
  }

  class BlockFactory {
    Block build(BlockType, Vec2)
  }

  abstract class Block {
    List<Controller>

    Block(Vec2)
    Vec2 getPosition()
    void setPosition(Vec2)
    void update(Context)
  }

  abstract class StaticBlock extends Block
  class WallBlock extends StaticBlock
  class TrashBlock extends StaticBlock
  class BombBlock extends StaticBlock

  class GarbageBlock extends Block
  class RobotBlock extends Block

  class Stage {
    StageController
    List<Block>
    Stage(Board)
    List<Block> getBlocks()
    void update(Context)
    bool isCleared()
  }
}

package controller {
  interface Controller {
    void update(Context)
  }

  abstract class BlockController implements Controller {
    Block
    Controller(Block)
    Block getBlock()
    void update(Context)
  }

  class BlockControllerFactory {
    BlockController build(Block)
  }

  class GameController implements Controller
  class StageController implements Controller

  abstract class PhysicsController extends BlockController
  abstract class DisplayController extends BlockController

  class WallPhysicsController extends PhysicsController
  class WallDisplayController extends DisplayController

  class TrashPhysicsController extends PhysicsController
  class TrashDisplayController extends DisplayController

  class GarbagePhysicsController extends PhysicsController
  class GarbageDisplayController extends DisplayController

  class RobotPhysicsController extends PhysicsController {
    List<TileVec2> path
  }

  class RobotDisplayController extends DisplayController

  class BombPhysicsController extends PhysicsController
  class BombDisplayController extends DisplayController
}

RobotPhysicsController --> PathFinder
RobotPhysicsController --> BoardConverter

Stage --> BoardConverter

PhysicsController --() JBox2D
Zen5 ()-- Viewer

viewer --> context
viewer --> model

context --> event

model --> controller

board --> model

@enduml