Changes
Page history
Make View and Model consistent
authored
Mar 01, 2021
by
Karikó Csongor Csanád
Show whitespace changes
Inline
Side-by-side
Class-Diagram.md
View page @
ed2b0e29
...
...
@@ -26,8 +26,10 @@ package Model.Common {
}
interface IDisplayable {
+ IsVisible() : bool
+ GetPosition() : Vector2
+ GetVisible() : bool
+ GetModelObjectHandle() : ModelObjectHandle
+ GetState() : int
}
interface ITickable {
...
...
@@ -39,6 +41,11 @@ package Model.Common {
+ GetActions() : IEnumerable<Action>
}
interface IBuilder {
+ CanBuild(IMapObjectBlueprint, Orientation) : bool
+ Build(IMapObjectBlueprint, Orientation) : (IDisplayable, IInspectable)
}
class Singleton<T> <<Singleton>> {
- {static} instance : T
- Singleton()
...
...
@@ -47,12 +54,20 @@ package Model.Common {
class Simulation <<Singleton>> {
- people : Person[]
- map : Map
- park : Park
- Simulation()
+ Create(SimulationConfig)
+ GetPark() : IInspectable
+ GetBuilder() : IBuilder
+ Tick() : IEnumerable<(IDisplayable, IInspectable)>
}
Simulation --|> Singleton
Simulation --> Park
Simulation --> MaintenanceDispatcher
class Park <<Singleton>> {
- balance : int
- entryFee : int
...
...
@@ -67,7 +82,9 @@ package Model.Common {
+ ModifyBalance(int)
+ AddBuilding(Building)
+ SetEntryFee(int)
+ Tick()
}
Park implements ITickable
Park --|> Singleton
Park --|> IInspectable
...
...
@@ -133,8 +150,8 @@ package Model.Map {
class Map {
+ Map(Vector2)
+ CanBuild(IMapObjectBlueprint) : bool
+ Build(IMapObjectBlueprint)
+ CanBuild(IMapObjectBlueprint
, Orientation
) : bool
+ Build(IMapObjectBlueprint
, Orientation) : (IDisplayable, IInspectable
)
}
Map *- "*" Cell
Map *-- "1" NavigationGraph
...
...
@@ -317,37 +334,44 @@ package Model.Landscape {
```
**View**
```
plantuml
@startuml View
skinparam classAttributeIconSize 0
left to right direction
class Model.Simulation {
+ Simulation(SimulationConfig)
+ GetCompany() : IInspectable
- people : Person[]
- map : Map
- park : Park
- Simulation()
+ Create(SimulationConfig)
+ GetPark() : IInspectable
+ GetBuilder() : IBuilder
+ Tick() :
List
<(IDisplayable, IInspectable)>
// list of new visitors / staff
+ Tick() :
IEnumerable
<(IDisplayable, IInspectable)>
}
interface Model.IBuilder {
+
IsPlacementAllowe
d(IMapObjectBlueprint, Orientation) : bool
+
Place
(IMapObjectBlueprint, Orientation) : (IDisplayable, IInspectable)
+
CanBuil
d(IMapObjectBlueprint, Orientation) : bool
+
Build
(IMapObjectBlueprint, Orientation) : (IDisplayable, IInspectable)
}
interface Model.IInspectable {
+ Get
ModelObjectRef() : ModelObjectRef
+ Get
Properties() : List<Property>()
+ Get
Properties() : IEnumerable<Property>
+ Get
Actions() : IEnumerable<Action>
}
interface Model.IDisplayable {
+ IsAlive() : bool
+ IsVisible() : bool
+ GetPosition() : Vector2
+ GetModelObjectHandle() : ModelObjectHandle
+ GetState() : int
}
class Model.ModelObjectHandle {
+ IsValid() : bool
}
/' END OF MODEL '/
UnityEngine.MonoBehaviour <|-- View.SingletonMonobehaviour
...
...
...
...