Game.Tools.IZoningInfoSystem
Assembly:
Namespace: Game.Tools
Type: interface
Base: None
Summary:
Interface that exposes zoning evaluation results produced by the zoning evaluation subsystem. Implementations provide access to a Unity.Collections.NativeList of ZoneEvaluationUtils.ZoningEvaluationResult values which represent the outcome of zoning analysis used by tools/systems that inspect or act on zoning data. The list is intended to be read (and/or consumed in jobs) by other systems; ownership and lifetime are managed by the implementing system.
Fields
- This interface defines no instance fields.
Implementations may have internal fields to store the NativeList or other state, but the interface itself only exposes a read-only property.
Properties
public Unity.Collections.NativeList<ZoneEvaluationUtils.ZoningEvaluationResult> evaluationResults { get; }
Read-only property that returns a NativeList containing zoning evaluation results. Typical usage is to read items (or schedule jobs that read from it) rather than to dispose or reassign the list. Consult the implementing system's documentation for lifetime/ownership rules (who is responsible for disposing, whether the list is valid only for a frame, etc.). Because this is a NativeList, be careful about thread-safety and use the appropriate Unity job safety patterns if accessing from jobs.
Constructors
- Interfaces do not declare constructors.
Concrete implementations will provide construction/initialization logic; users should obtain a reference to an implementation from the relevant service locator or system registry used by the game.
Methods
- This interface declares no methods.
It only exposes the zoning evaluation results via the property above.
Usage Example
using Game.Tools;
using Game.Simulation;
using Unity.Collections;
// Example: reading evaluation results from an implementation
public void ProcessZoningResults(IZoningInfoSystem zoningSystem)
{
var results = zoningSystem.evaluationResults;
for (int i = 0; i < results.Length; i++)
{
var result = results[i];
// Inspect fields on result (e.g., zone type, score, position)
// Handle accordingly...
}
}
// Example: simple implementation sketch (ownership/lifetime must be defined by real system)
public class ZoningInfoSystem : IZoningInfoSystem
{
public NativeList<ZoneEvaluationUtils.ZoningEvaluationResult> evaluationResults { get; private set; }
public ZoningInfoSystem(Allocator allocator)
{
evaluationResults = new NativeList<ZoneEvaluationUtils.ZoningEvaluationResult>(allocator);
}
public void Dispose()
{
if (evaluationResults.IsCreated)
evaluationResults.Dispose();
}
}
Notes: - Always verify the ownership/lifetime semantics for the returned NativeList in the concrete implementation you are using. Do not dispose the list unless the implementation explicitly delegates ownership to you. - When accessing the list from jobs, ensure proper safety handles and scheduling to avoid race conditions.