FenceLibrary/FenceDefinition.cs
using System.Collections.Generic;
/// <summary>
/// Authored data for the in-editor fence placement tool.
/// </summary>
[AssetType( Name = "Fence Definition", Extension = "fencedef", Category = "World" )]
public sealed class FenceDefinition : GameResource
{
/// <summary>
/// Display name used for the parent GameObject created when a fence run is placed.
/// </summary>
public string RootName { get; set; } = "Fence";
/// <summary>
/// Fence segment entries that the editor tool can place along a line.
/// </summary>
public List<FenceDefinitionEntry> Entries { get; set; } = [];
/// <summary>
/// When enabled, the tool uses entry weights when choosing between multiple fitting segments.
/// </summary>
public bool UseWeightedRandom { get; set; } = true;
/// <summary>
/// Hard cap for how many segments one drag operation may place.
/// </summary>
public int MaximumSegments { get; set; } = 256;
/// <summary>
/// Extra spacing inserted between placed segments after their measured bounds are aligned.
/// </summary>
public float SegmentGap { get; set; } = 0.0f;
/// <summary>
/// Minimum random rotation offset applied independently to each placed segment. Leave both rotation randomization values at zero to disable rotation randomization.
/// </summary>
public Angles RotationRandomizationMin { get; set; } = Angles.Zero;
/// <summary>
/// Maximum random rotation offset applied independently to each placed segment. Leave both rotation randomization values at zero to disable rotation randomization.
/// </summary>
public Angles RotationRandomizationMax { get; set; } = Angles.Zero;
/// <summary>
/// Minimum random distance adjustment applied after each placed segment. Positive values add gaps; negative values allow overlap.
/// </summary>
public float DistanceRandomizationMin { get; set; } = 0.0f;
/// <summary>
/// Maximum random distance adjustment applied after each placed segment. Leave both distance randomization values at zero to disable distance randomization.
/// </summary>
public float DistanceRandomizationMax { get; set; } = 0.0f;
/// <summary>
/// When enabled, committed fence runs create one navmesh blocker volume for each placed segment.
/// </summary>
public bool CreateBlockerVolumes { get; set; } = true;
}
/// <summary>
/// A single fence segment source that can be placed by the fence tool.
/// </summary>
public sealed class FenceDefinitionEntry
{
/// <summary>
/// Optional display name used in previews and for created segment object names.
/// </summary>
public string DisplayName { get; set; } = string.Empty;
/// <summary>
/// Optional model source used for this segment when no prefab is assigned.
/// </summary>
public Model Model { get; set; }
/// <summary>
/// Optional prefab source used for this segment. Prefabs take priority over models when both are assigned.
/// </summary>
public PrefabFile Prefab { get; set; }
/// <summary>
/// Authored rotation offset that tells the tool which way the segment runs lengthwise.
/// </summary>
public Angles RotationOffset { get; set; } = Angles.Zero;
/// <summary>
/// Relative selection weight used when weighted random placement is enabled.
/// </summary>
public float Weight { get; set; } = 1.0f;
}