Interface IEnvironmentAPI
Provides access to environment-level APIs, including user interface system functionality.
Namespace: Fwt.HexTerrains
Assembly: fwt.hexterrains.dll
Syntax
public interface IEnvironmentAPI
Properties
EntityManager
Gets or sets the entity manager used to coordinate entity operations.
Declaration
EntityManager EntityManager { get; set; }
Property Value
| Type | Description |
|---|---|
| EntityManager |
EnvironmentAPIEntity
Cached entity that holds the Environment API in it's component.
Declaration
Entity EnvironmentAPIEntity { get; set; }
Property Value
| Type | Description |
|---|---|
| Entity |
UISystemAPI
Gets the interface for interacting with the UI system API.
Declaration
IUISystemAPI UISystemAPI { get; set; }
Property Value
| Type | Description |
|---|---|
| IUISystemAPI |
Methods
CreateUIScreen<TScreen>()
Creates a new screen of the specified type.
Declaration
TScreen CreateUIScreen<TScreen>() where TScreen : UIScreen
Returns
| Type | Description |
|---|---|
| TScreen | screen instance |
Type Parameters
| Name | Description |
|---|---|
| TScreen | type of the screen to create |
DestroyTerrain(Entity)
Destroys a terrain entity provided.
Declaration
bool DestroyTerrain(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | terrain entity to destroy |
Returns
| Type | Description |
|---|---|
| bool | true if was destroyed, otherwise - false |
DestroyUIScreen(UIScreen)
Destroys the specified screen instance.
Declaration
bool DestroyUIScreen(UIScreen screen)
Parameters
| Type | Name | Description |
|---|---|---|
| UIScreen | screen | screen instance to destroy |
Returns
| Type | Description |
|---|---|
| bool | true if the screen was destroyed successfully; otherwise, false |
DestroyUIScreen<TScreen>()
Destroys the specified screen.
Declaration
bool DestroyUIScreen<TScreen>() where TScreen : UIScreen
Returns
| Type | Description |
|---|---|
| bool | true if the screen was destroyed successfully; otherwise, false |
Type Parameters
| Name | Description |
|---|---|
| TScreen | type of a screen to destroy |
GetBrushColor(Entity)
Returns the brush color from the TerrainEntity HexTerrainBrush.
Declaration
Color32? GetBrushColor(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| Color32? | brush color if found, otherwise - false |
GetBrushOpacity(Entity)
Returns the brush opacity from the TerrainEntity HexTerrainBrush.
Declaration
float? GetBrushOpacity(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| float? | brush opacity if brush is found, otherwise - null |
GetBrushSize(Entity)
Returns the brush size from the TerrainEntity HexTerrainBrush.
Declaration
int? GetBrushSize(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| int? | brush size if found, otherwise - null |
GetBrushView(Entity)
Returns the brush view from the TerrainEntity HexTerrainBrushView.
Declaration
HexTerrainBrushView GetBrushView(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| HexTerrainBrushView | brush view from the TerrainEntity if found, otherwise - null |
GetCellCoordUnderCursor(Entity)
Returns the cell coordinate under the cursor.
Declaration
int2? GetCellCoordUnderCursor(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| int2? | cell coordinate if found and raycast hit the terrain, otherwise - false |
GetCellIndexUnderCursor(Entity)
Returns the cell index under the cursor.
Declaration
int? GetCellIndexUnderCursor(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| int? | cell index if found and raycast hit the terrain, otherwise - false |
GetHexTerrainPrefabConfigsBuffer<THexTerrainPrefabConfig>()
Returns a list of available HexTerrainPrefabConfigs from the EnviromentAPI entity (if any)
Declaration
DynamicBuffer<THexTerrainPrefabConfig> GetHexTerrainPrefabConfigsBuffer<THexTerrainPrefabConfig>() where THexTerrainPrefabConfig : unmanaged, IBufferElementData, IHexTerrainPrefabConfig
Returns
| Type | Description |
|---|---|
| DynamicBuffer<THexTerrainPrefabConfig> |
Type Parameters
| Name | Description |
|---|---|
| THexTerrainPrefabConfig | type of HexTerrainPrefabConfig you have |
GetHexTerrainPrefabConfigsList()
Returns a list of available HexTerrainPrefabConfigs from the EnviromentAPI entity (if any). This list can be sent to the UI to display available terrain prefabs for the user to select from.
Declaration
IList<IHexTerrainPrefabConfig> GetHexTerrainPrefabConfigsList()
Returns
| Type | Description |
|---|---|
| IList<IHexTerrainPrefabConfig> | collection of hex terrain prefab configs for user to select from |
GetIsResizableBrush(Entity)
Returns true if the brush on TerrainEntity is resizable.
Declaration
bool GetIsResizableBrush(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| bool | is brush found and resizable |
GetIsTerrainVisible(Entity)
Returns true if terrain is visible, false is invisible, null if no terrain with visibility foundHexTerrainVisibility.
Declaration
bool? GetIsTerrainVisible(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| bool? | true if terrain is visible, false is invisible, null if no terrain with visibility found |
GetIsVisibleBrush(Entity)
Returns true if the brush on TerrainEntity is visible.
Declaration
bool GetIsVisibleBrush(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| bool | true if brush is found and is visible, otherwise - false |
GetMinimapScreen()
Gets the Minimap UI Screen (if present).
Declaration
IMinimapScreen GetMinimapScreen()
Returns
| Type | Description |
|---|---|
| IMinimapScreen | An IMinimapScreen representing the minimap screen. Returns null if no minimap screen is available. |
GetOrCreateUIScreen<TScreen>()
Gets an existing screen of the specified type, or creates a new one if it doesn't exist.
Declaration
TScreen GetOrCreateUIScreen<TScreen>() where TScreen : UIScreen
Returns
| Type | Description |
|---|---|
| TScreen | screen instance |
Type Parameters
| Name | Description |
|---|---|
| TScreen | type of the screen to get or create |
GetRaycastData(Entity)
Returns the Raycast data from the TerrainEntity HexTerrainRaycastData. this data contains information about the raycast from mouse to terrain result.
Declaration
HexTerrainRaycastData? GetRaycastData(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| HexTerrainRaycastData? | raycast data from the TerrainEntity |
GetSimulationSpeedScreen()
Retrieves the screen interface used to control or display the simulation speed settings.
Declaration
ISimulationSpeedScreen GetSimulationSpeedScreen()
Returns
| Type | Description |
|---|---|
| ISimulationSpeedScreen | An object that provides access to simulation speed controls and information. Returns an implementation of ISimulationSpeedScreen. |
GetTerrainLayer<TDataLayer>(Entity)
returns a data layer from the TerrainEntity GetTerrainEntity()
Declaration
TDataLayer GetTerrainLayer<TDataLayer>(Entity terrainEntity) where TDataLayer : class
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| TDataLayer | data layer if found, otherwise - null |
Type Parameters
| Name | Description |
|---|---|
| TDataLayer |
GetTerrainSettings(Entity)
Returns a Terrain Settings if found.
Declaration
HexTerrainSettings? GetTerrainSettings(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| HexTerrainSettings? | terrain settings if found or null if not found |
GetUIScreen<TScreen>()
Gets an existing screen of the specified type if found.
Declaration
TScreen GetUIScreen<TScreen>() where TScreen : UIScreen
Returns
| Type | Description |
|---|---|
| TScreen |
Type Parameters
| Name | Description |
|---|---|
| TScreen | type of the screen to get |
GetUserToolsScreen()
Gets the User Tools UI Screen (if present).
Declaration
IUserToolsScreen GetUserToolsScreen()
Returns
| Type | Description |
|---|---|
| IUserToolsScreen | An IUserToolsScreen instance representing the user tools screen. Returns |
GetViewMode(Entity)
Returns the view mode of the TerrainEntity HexTerrainViewMode.
Declaration
int GetViewMode(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| int | view mode if found, otherwise - false |
Init(EntityManager, IUISystemAPI, Entity)
Initializes with the specified environment entity, UI system API, and entity manager.
Declaration
void Init(EntityManager entityManager, IUISystemAPI uiSystemApi, Entity environmentEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityManager | entityManager | The entity manager responsible for managing entities within the environment. |
| IUISystemAPI | uiSystemApi | The UI system API used to interact with user interface components. |
| Entity | environmentEntity | The entity that holds this API instance. |
IsTerrainLayerSupported<TDataLayer>(Entity)
Checks if the data layer is supported by the terrain. Usually means if terrain has this data layer.
Declaration
bool IsTerrainLayerSupported<TDataLayer>(Entity terrainEntity) where TDataLayer : class
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| bool | true if supports, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TDataLayer | type of the TerrainLayer to check |
LoadTerrain(Entity, string)
Loads the TerrainEntity from a file.
Declaration
bool LoadTerrain(Entity terrainEntity, string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| string | filePath | file path to load a terrain from |
Returns
| Type | Description |
|---|---|
| bool | true if loaded, otherwise - false |
ResizeTerrain(Entity, int2)
Resizes the TerrainEntity TerrainSize.
Declaration
bool ResizeTerrain(Entity terrainEntity, int2 terrainSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| int2 | terrainSize | new terrain size |
Returns
| Type | Description |
|---|---|
| bool | true if was resized, otherwise - false |
SaveTerrain(Entity, string)
Saves the TerrainEntity to a file.
Declaration
bool SaveTerrain(Entity terrainEntity, string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| string | filePath | file path to save a terrain into |
Returns
| Type | Description |
|---|---|
| bool | true if terrain has been saved, otherwise - false |
SetBrushOpacity(Entity, float)
Sets the brush opacity on the TerrainEntity HexTerrainBrush.
Declaration
bool SetBrushOpacity(Entity terrainEntity, float opacity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| float | opacity | new opacity value (0..1) |
Returns
| Type | Description |
|---|---|
| bool | true if value has been set, otherwise - false |
SetBrushSize(Entity, int)
Sets the brush size on the TerrainEntity HexTerrainBrush.
Declaration
bool SetBrushSize(Entity terrainEntity, int brushSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| int | brushSize | new brush size |
Returns
| Type | Description |
|---|---|
| bool | true if value has been set, otherwise - false |
SetIsResizableBrush(Entity, bool)
Sets the IsResizable value of the brush on TerrainEntity HexTerrainBrush.
Declaration
bool SetIsResizableBrush(Entity terrainEntity, bool isResizableBrush)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| bool | isResizableBrush | new value for IsResizable |
Returns
| Type | Description |
|---|---|
| bool | true if value has been set, otherwise - false |
SetIsTerrainVisible(Entity, bool)
Sets terrain visibility. HexTerrainVisibility Returns true if value was set
Declaration
bool SetIsTerrainVisible(Entity terrainEntity, bool isVisible)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| bool | isVisible | New visibility value for terrain |
Returns
| Type | Description |
|---|---|
| bool | True if value was set, otherwise - false |
SetIsVisibleBrush(Entity, bool)
Sets the IsVisible value of the brush on TerrainEntity HexTerrainBrush.
Declaration
bool SetIsVisibleBrush(Entity terrainEntity, bool isVisibleBrush)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| bool | isVisibleBrush | new IsVisible value |
Returns
| Type | Description |
|---|---|
| bool | true if value has been set, otherwise - false |
SetViewMode(Entity, SetViewModeRequest)
Sets the view mode based on the parameters specified in the request.
Declaration
bool SetViewMode(Entity terrainEntity, SetViewModeRequest request)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| SetViewModeRequest | request | An object that specifies the view mode to set, either by index or by name. The request must indicate which method to use. |
Returns
| Type | Description |
|---|---|
| bool | true if the view mode is successfully set; otherwise, false. |
Remarks
If neither the view mode index nor the view mode name is specified in the request, the method returns false.
SetViewMode(Entity, int)
Sets the view mode on the TerrainEntity HexTerrainViewMode.
Declaration
bool SetViewMode(Entity terrainEntity, int viewMode)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| int | viewMode | new view mode |
Returns
| Type | Description |
|---|---|
| bool | true if value has been set, otherwise - false |
SetViewMode(Entity, string)
Sets the view mode on the TerrainEntity HexTerrainViewMode by view mode name.
Declaration
bool SetViewMode(Entity terrainEntity, string viewModeName)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity | |
| string | viewModeName | name of the new view mode |
Returns
| Type | Description |
|---|---|
| bool | true if value has been set, otherwise - false |
ToggleIsTerrainVisible(Entity)
Toggles the visibility of the terrain on the TerrainEntity HexTerrainVisibility.
Declaration
bool? ToggleIsTerrainVisible(Entity terrainEntity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | terrainEntity |
Returns
| Type | Description |
|---|---|
| bool? | True if terrain now visible, false is invisible, null if no terrain with visibility found |