This component is used to decorate parts of the map. Current decorator version supports:
-
Customizing the label of a country
-
Colorize a country with a custom color
-
Assign a texture to a country, with scale, offset and rotation options.
You may use this component in two ways:
-
From the Editor, clicking on the “Open Decorator” button at the bottom of the World Map Globe inspector.
-
From code, using any of its API through map.decorator accessor. The first time you use its API, it will automatically add the component to the globe gameObject.
In the Editor, this component has this interface (on the right):
The API of this component has several methods but the most important are:
map.decorator.SetCountryDecorator(int groupIndex, string countryName, CountryDecorator decorator)
This will assign a decorator to specified country. Decorators are objects that contains customization options and belong to one of the existing groups. This way you can enable/disable a group and all decorators of that group will be enabled/disabled at once (for instance, you may group several countries in the same group).
map.decorator.RemoveCountryDecorator(int groupIndex, string countryName)
This method will remove a decorator from the group and its effects will be removed.
A decorator object has the following fields:
- countryName: the name of the country to be decorated. It will be assigned automatically when using SetCountryDecorator method.
- customLabel: leave it as “” to preserve current country label.
- isColorized: if the country is colorized.
- fillColor: the colorizing color.
- labelOverridesColor: if the color of the label is specified.
- labelColor: the color of the label.
- labelVisible: sets the label visible or hidden.
- labelOffset: specifies a manual offset for the label with respect to the country center. A default value of (0,0) will make the label to automatically shift if needed.
- labelRotation: manual rotation for the label in degrees (0-359). If set to zero, the label can be automatically rotated by the system.
- texture: the texture to assign to the country.
- textureScale, textureOffset and textureRotation allows to tweak how the texture is mapped to the surface.