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