Views
Views can be used to alter the way the world looks and for presenting additional information to the player. In the Three and Urban Demos they are activated and deactivated in the UI using a ViewActivator. In the Defense Demo only one View exists that is always supposed to be active so it is assigned as the DefaultView in the DefaultViewManager.
Views are ScriptableObjects which are found in the ContextMenu > CityBuilder-Views-…
The following Views are included in CCBK.
- Composite
Placeholder for multiple other Views(only one view is active at a time in IViewsManager) - Culling
Applies a LayerMask to the main camera - Layer
Visualizes the values of a layer on the map using IOverlayManager - Connection
Visualizes the values of a connection on the map using IOverlayManager - Efficiency
Visualizes the efficiency of Buildings map using IOverlayManager - BuildingBars
Visualizes an IBuildingValue by adding a BuildingValueBar for appropriate Buildings using IBarManager - WalkerBars
Visualizes an IWalkerValue by adding a WalkerValueBar for appropriate Walkers using IBarManager
To create your own View just derive from View and override the Activate and Deactivate Methods.
Values
IBuildingValue and IWalkerValue are used to query Builders and and Walkers for certain numbers. For example the implementation of IWalkerValue on the Item ScriptableObject returns the item quantity that the pertaining walker carries. Most Values are implemented in ScriptableObjects(Risks, Services, Items, …). A good Example for a Value that is implemented on the View instead is the IHealther Interface.
Bars
Bars initiated by the Building-/WalkerBars Views and managed by the IBarManager are the visual representation of a IBuildingValue or IWalkerValue. They are not specific to a certain Value but rather just translate the number returned by the Value to a viewable form. When a BarView is activated the IBarManager instantiates Bars in all the appropriate entities.
Creating a new Bar is done by deriving from BuildingValueBar or WalkerValueBar. These base classes provide all the necessary Methods to get the Values(HasValue, GetMaximum, GetValue, ….)