Game.Prefabs.CityBoundaryPrefab
Assembly: Assembly-CSharp (game)
Namespace: Game.Prefabs
Type: class
Base: PrefabBase
Summary:
A prefab class that defines data used to render the city/map boundary lines. Exposes material and visual parameters (width, tiling and colors) that can be configured in the Unity Inspector. At runtime this prefab declares that entities using it require a CityBoundaryData component (added to the prefab component list).
Fields
-
public UnityEngine.Material m_Material
This material is used to render the boundary lines. Assign a shader/material that supports the intended tiling and color behavior. Serialized and editable in the Inspector. -
public System.Single m_Width = 20f
World-space width of the boundary line in Unity units. Default: 20f. -
public System.Single m_TilingLength = 80f
Length (in world units) used to determine texture tiling along the boundary. Default: 80f. -
public UnityEngine.Color m_CityBorderColor = new Color(1f, 1f, 1f, 0.75f)
Color used for the city boundary line (RGBA). Default is white with 75% alpha. -
public UnityEngine.Color m_MapBorderColor = new Color(1f, 1f, 1f, 0.25f)
Color used for the map border (e.g., when showing the map extent). Default is white with 25% alpha.
Properties
- (none)
This prefab class does not declare C# properties. All configurable data is exposed as public fields for Unity serialization and inspector editing.
Constructors
public CityBoundaryPrefab()
No explicit constructor is declared in the source — the class uses the default parameterless constructor. Field default values (m_Width, m_TilingLength, m_CityBorderColor, m_MapBorderColor) are initialized inline.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds required ECS component types to the prefab's component set. Implementation calls the base PrefabBase.GetPrefabComponents(components) and then ensures the prefab includes a read/write CityBoundaryData component by adding ComponentType.ReadWrite(). This signals the entity creation code that entities created from this prefab should have CityBoundaryData.
Usage Example
// Example: configuring the prefab in code (typically you set these in the Inspector)
public class ConfigureBoundary : MonoBehaviour
{
public CityBoundaryPrefab boundaryPrefab;
void Start()
{
if (boundaryPrefab != null)
{
// set material and visual parameters
boundaryPrefab.m_Material = /* assign a material */;
boundaryPrefab.m_Width = 30f;
boundaryPrefab.m_TilingLength = 100f;
boundaryPrefab.m_CityBorderColor = new Color(0.9f, 0.9f, 0.9f, 0.85f);
boundaryPrefab.m_MapBorderColor = new Color(1f, 1f, 1f, 0.2f);
}
}
}
// The prefab itself declares the ECS requirement:
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
base.GetPrefabComponents(components);
components.Add(ComponentType.ReadWrite<CityBoundaryData>());
}
Additional notes: - Because fields are public, they are exposed to the Unity Inspector and can be tweaked without code changes. - CityBoundaryData must be defined elsewhere (an ECS component type representing boundary-specific runtime data).