Update Class Diagram authored by kgerg2's avatar kgerg2
...@@ -51,63 +51,70 @@ package Model.Common { ...@@ -51,63 +51,70 @@ package Model.Common {
} }
class Singleton<T> <<Singleton>> {
- {static} instance : T
- Singleton()
+ {static} GetInstance() : T
}
class Simulation <<Singleton>> { class Simulation <<Singleton>> {
- people : Person[] - people : Person[]
- map : Map - map : Map
- park : Park - park : Park
- currentTickResult : TickResult - currentTickResult : TickResult
- config : SimulationConfig
- instance : Simulation {static}
+ random : Random {readonly} {static}
- Simulation() - Simulation()
+ CreateOnce(SimulationConfig) {static} + CreateOnce(SimulationConfig) {static}
+ GetMoney() : int + GetMoney() : int
+ GetPark() : IInspectable + GetPark() : IInspectable
+ GetEntrance() : (IDisplayable, IInspectable)
+ GetBuilder() : IBuilder + GetBuilder() : IBuilder
+ AddPerson(Person) + GetMap() : Map
+ AddPerson(MaintenanceGuy) + GetInstance() : Simulation {static}
+ AddPerson(CleaningLady) + AddPerson(Visitor)
+ AddPerson(MaintenanceStaff)
+ AddPerson(CleaningStaff)
+ Tick() : TickResult + Tick() : TickResult
} }
Simulation --|> Singleton Simulation --|> IBuilder
Simulation --> Park Simulation --> Park
Simulation --> MaintenanceDispatcher Simulation --> MaintenanceDispatcher
Simulation *- TickResult Simulation *- TickResult
class TickResult { class TickResult {
+ GameOver : bool + GameOver : bool
+ {field} NewVisitors : IEnumerable<(IDisplayable, IInspectable)> + {field} NewVisitors : ICollection<(IDisplayable, IInspectable)>
+ {field} NewCleaningStaff : IEnumerable<(IDisplayable, IInspectable)> + {field} NewCleaningStaff : ICollection<(IDisplayable, IInspectable)>
+ {field} NewMaintenanceStaff : IEnumerable<(IDisplayable, IInspectable)> + {field} NewMaintenanceStaff : ICollection<(IDisplayable, IInspectable)>
} }
class Park <<Singleton>> { class Park <<Singleton>> {
- balance : int - balance : int
- entryFee : int - entryFee : int
- buildings : Building[] - entrance : Pavement
- pavements : Pavement[]
- visitableBuildings : VisitableBuilding[]
- staffBuildings : StaffBuilding[]
- instance : Park {static}
- Park() - Park()
+ GetInstance() : Park {static}
+ GetBalance() : int + GetBalance() : int
+ GetEntryFee() : int + GetEntryFee() : int
+ GetBuildings() : Building[] + GetEntrance() : Pavement
+ GetEntrance() : Building + GetPavements() : Pavement[]
+ GetVisitableBuildings() : VisitableBuilding[]
+ GetStaffBuildings() : StaffBuilding[]
+ GetProperties() : IEnumerable<Property> {override} + GetProperties() : IEnumerable<Property> {override}
+ GetActions() : IEnumerable<Action> {override} + GetActions() : IEnumerable<Action> {override}
+ ModifyBalance(int) + ModifyBalance(int)
+ AddBuilding(Building) + AddBuilding(Building)
+ SetEntryFee(int) + SetEntryFee(int)
+ Tick() + Tick() {override}
} }
Park --|> ITickable Park --|> ITickable
Park --|> Singleton
Park --|> IInspectable Park --|> IInspectable
class WorldEntity { class WorldEntity {
- position : Vector2 - position : Vector2
- visible : bool - visible : bool
# WorldEntity()
# WorldEntity(Vector2) # WorldEntity(Vector2)
+ GetPosition() : Vector2 + GetPosition() : Vector2
+ GetVisible() : bool + GetVisible() : bool
...@@ -117,10 +124,13 @@ package Model.Common { ...@@ -117,10 +124,13 @@ package Model.Common {
WorldEntity --|> IDisplayable WorldEntity --|> IDisplayable
class MaintenanceDispatcher <<static>> { class MaintenanceDispatcher <<static>> {
- {static} maintainers : MaintenanceGuy[] - {static} maintainers : MaintenanceStaff[]
- {static} backlog : Queue<MapObject>
- MaintenanceDispatcher() - MaintenanceDispatcher()
+ {static} GameBroken(Building) + {static} GameBroken(MapObject)
+ {static} Tick()
} }
} }
package Model.Map { package Model.Map {
...@@ -129,18 +139,27 @@ package Model.Map { ...@@ -129,18 +139,27 @@ package Model.Map {
+ AddVertex() : VertexHandle + AddVertex() : VertexHandle
+ AddEdge(VertexHandle, VertexHandle) + AddEdge(VertexHandle, VertexHandle)
+ PlanRoute(VertexHandle, VertexHandle) : RouteHandle + PlanRoute(VertexHandle, VertexHandle) : RouteHandle
+ GetNextOnRoute(RouteHandle) : VertexHandle
} }
class VertexHandle { class VertexHandle {
+ {static} INVALID : VertexHandle
+ VertexHandle(int)
+ GetID() : int
} }
class RouteHandle { class RouteHandle {
+ {static} INVALID : RouteHandle
+ At : VertexHandle
+ To : VertexHandle
+ RouteHandle(VertexHandle, VertexHandle)
} }
} }
abstract class MapObject { abstract class MapObject {
+ Vertices : ICollection<VertexHandle>
# position : MapObjectPosition
# MapObject(MapObjectPosition)
+ Enter(Person) : Vector2? {abstract} + Enter(Person) : Vector2? {abstract}
+ Exit(Person) {abstract} + Exit(Person) {abstract}
} }
...@@ -170,14 +189,26 @@ package Model.Map { ...@@ -170,14 +189,26 @@ package Model.Map {
} }
class Map { class Map {
+ Map(Vec2i, float) - nav : NavigationGraph
- grid : Cell[,]
- width : int
- height : int
+ Map(int, int, float)
+ CanBuild(IMapObjectBlueprint, MapPosition) : bool + CanBuild(IMapObjectBlueprint, MapPosition) : bool
+ Build(IMapObjectBlueprint, MapPosition): (IDisplayable, IInspectable) + Build(IMapObjectBlueprint, MapPosition): MapObject
+ GetNavigationGraph() : NavigationGraph
+ GetScale() : float
+ {method} [Vertexhandle] : MapObject
- ConnectNavigableCells(MapObject, Vec2i, MapPosition, IEnumerable<NavigableCell>)
- IsInside(int, int) : bool
- IsInside(Vec2i) : bool
- GetNeighbor(Vec2i, Orientation) : Vec2i
- MapPosition(Vec2i, Orientation, Vec2i) : Vec2i
- AdjustSize(Vec2i, Orientation) : Vec2i
} }
Map *- "*" Cell Map *- "*" Cell
Map o-- "1" NavigationGraph Map o-- "1" NavigationGraph
Simulation *-- "1" Map Simulation *-- "1" Map
IBuilder <|-- Map
class NavigableCell { class NavigableCell {
+ Pos : Vec2i + Pos : Vec2i
...@@ -203,15 +234,17 @@ package Model.People { ...@@ -203,15 +234,17 @@ package Model.People {
- destination : MapObject - destination : MapObject
- nextPosition : Vector2 - nextPosition : Vector2
- speed : float {readonly} - speed : float {readonly}
- pavement : Pavement
- routeHandle : RouteHandle
- name : string - name : string
# Person(Vector2, float) - routeHandle : RouteHandle
- nextVertexHandle : VertexHandle
# Person(Vector2, VertexHandle, float, string)
+ Tick() {override} + Tick() {override}
+ GetProperties() : IEnumerable<Property> {override} + GetProperties() : IEnumerable<Property> {override}
+ GetActions() : IEnumerable<Action> {override} + GetActions() : IEnumerable<Action> {override}
+ GetDestination() + GetDestination()
+ SetDestination(MapObject) + SetDestination(MapObject)
- StepPerson()
- CalculateNextStep()
} }
class VisitorEffect { class VisitorEffect {
...@@ -225,7 +258,7 @@ package Model.People { ...@@ -225,7 +258,7 @@ package Model.People {
- satiety : int - satiety : int
- money : int - money : int
- inQueue : bool - inQueue : bool
+ Visitor(Vector2, float, int, int, int) + Visitor(Vector2, VertexHandle, float, string, int, int, int)
- ChooseDestination() - ChooseDestination()
+ DeliverEffects(VisitorEffect) + DeliverEffects(VisitorEffect)
+ GameEnded(Vector2) + GameEnded(Vector2)
...@@ -235,12 +268,13 @@ package Model.People { ...@@ -235,12 +268,13 @@ package Model.People {
+ ModifySatiety(int) + ModifySatiety(int)
+ ModifyMoney(int) + ModifyMoney(int)
+ SetInQueue(bool) + SetInQueue(bool)
- ChooseDestination()
} }
Visitor --|> Person Visitor --|> Person
class Staff { class Staff {
- idle : bool - idle : bool
# Staff(Vector2, float) # Staff(Vector2, VertexHandle, float, string)
+ Tick() {override} + Tick() {override}
+ GetProperties() : IEnumerable<Property> {override} + GetProperties() : IEnumerable<Property> {override}
+ IsIdle() : bool + IsIdle() : bool
...@@ -248,20 +282,20 @@ package Model.People { ...@@ -248,20 +282,20 @@ package Model.People {
} }
Staff --|> Person Staff --|> Person
class CleaningLady { class CleaningStaff {
+ CleaningLady(Vector2, float) + CleaningStaff(Vector2, VertexHandle, float, string)
+ Tick() {override} + Tick() {override}
+ GetProperties() : IEnumerable<Property> {override} + GetProperties() : IEnumerable<Property> {override}
} }
CleaningLady --|> Staff CleaningStaff --|> Staff
class MaintenanceGuy { class MaintenanceStaff {
+ MaintenanceGuy(Vector2, float) + MaintenanceStaff(Vector2, VertexHandle, float, string)
+ Tick() {override} + Tick() {override}
+ GetProperties() : IEnumerable<Property> {override} + GetProperties() : IEnumerable<Property> {override}
} }
MaintenanceGuy --|> Staff MaintenanceStaff --|> Staff
MaintenanceDispatcher *--- "-maintainers\n*\n" MaintenanceGuy MaintenanceDispatcher *--- "-maintainers\n*\n" MaintenanceStaff
} }
...@@ -416,8 +450,8 @@ class Model.Simulation { ...@@ -416,8 +450,8 @@ class Model.Simulation {
+ GetPark() : IInspectable + GetPark() : IInspectable
+ GetBuilder() : IBuilder + GetBuilder() : IBuilder
+ AddPerson(Person) + AddPerson(Person)
+ AddPerson(MaintenanceGuy) + AddPerson(MaintenanceStaff)
+ AddPerson(CleaningLady) + AddPerson(CleaningStaff)
+ Tick() : TickResult + Tick() : TickResult
} }
... ...
......