Game.Prefabs.CraneData
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
CraneData is a lightweight ECS component (plain data struct) that holds distance-range information for a crane prefab/actor. It is intended to be attached to entities and read by systems that implement crane-related logic (e.g., reach checks, target filtering, or animation/operation ranges). The range is represented by a Bounds1 value from Colossal.Mathematics, which encodes a 1-dimensional numeric range (min/max).
Fields
public Bounds1 m_DistanceRange
Holds the allowed/operative distance range for the crane. Systems should read this value to determine whether a target or action distance is within the crane's allowed interval. The exact construction/access pattern of Bounds1 depends on the Colossal.Mathematics API (min/max properties or constructors).
Properties
- This type defines no properties. It is a simple public-field data container used as an IComponentData.
Constructors
- No explicit constructors are defined. As a C# struct, CraneData has the default parameterless constructor which initializes m_DistanceRange to default(Bounds1). Create instances using object initializer syntax and assign a Bounds1 value constructed per the Bounds1 API.
Methods
- This type defines no methods. It serves solely as a data carrier for ECS systems.
Usage Example
// NOTE: Bounds1 construction depends on Colossal.Mathematics API.
// The following is a usage pattern; adjust Bounds1 creation to match its actual API.
var entity = entityManager.CreateEntity();
// Construct a Bounds1 representing the desired min/max range using the appropriate API:
Bounds1 range = default; // replace with actual constructor or assignment for Bounds1
// e.g. range = new Bounds1(minValue, maxValue); or set range.Min/Max if available
var crane = new CraneData { m_DistanceRange = range };
// Add the component to the entity
entityManager.AddComponentData(entity, crane);
// In a System, read or query CraneData
Entities.ForEach((ref CraneData craneData) =>
{
// Use craneData.m_DistanceRange here to decide reachability, filtering, etc.
// Example (pseudo): if (craneData.m_DistanceRange.Contains(distance)) { ... }
});