Game.Prefabs.PlaceableNetComposition
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
Represents placement-related cost parameters for a "net" prefab (e.g., road/rail/utility net) in the game's ECS. This is a plain value-type component intended to be attached to entities representing placeable net prefabs. Fields are simple cost values (construction, elevation, upkeep) and default to zero when the struct is not initialized explicitly.
Fields
-
public uint m_ConstructionCost
Represents the construction cost for placing this net prefab. Unsigned integer; uses 0 as the default. -
public uint m_ElevationCost
Represents any additional cost associated with elevating this net (for example, bridges, ramps). Unsigned integer; 0 by default. -
public float m_UpkeepCost
Represents the recurring upkeep cost (floating point). The exact time unit (per second, per game-day, etc.) depends on how the game uses this component elsewhere; it defaults to 0.0f.
Properties
- This type declares no properties. It exposes raw public fields only.
Constructors
public PlaceableNetComposition()
Default value-type constructor provided by C#. All fields are initialized to their default values (0, 0, 0.0f). No custom constructors are defined in the source.
Methods
- This type declares no methods.
Usage Example
// Create and attach the component to an existing entity (EntityManager API)
var comp = new PlaceableNetComposition {
m_ConstructionCost = 150u,
m_ElevationCost = 50u,
m_UpkeepCost = 2.5f
};
entityManager.AddComponentData(myPrefabEntity, comp);
// Read/modify in a system using Entities.ForEach (or a Job)
Entities
.ForEach((ref PlaceableNetComposition pnc) =>
{
// Example: increase upkeep slightly for some condition
pnc.m_UpkeepCost += 0.1f;
}).Schedule();
{{ Notes: - This component is a plain data container intended for the Unity ECS. Because it implements IComponentData it can be stored on entities and used in queries; IQueryTypeParameter indicates it's usable as a query parameter in Unity's ECS query APIs. - If you need additional derived behavior (validation, conversions, serialization helpers), implement that externally in systems or utility methods rather than in this struct. - Values are game-specific; confirm units and scaling by inspecting the systems that consume this component in the game's codebase. }}