46 lines
1.9 KiB
C#
46 lines
1.9 KiB
C#
using ProjectM.Simulation;
|
|
using Unity.Entities;
|
|
using UnityEngine;
|
|
|
|
namespace ProjectM.Authoring
|
|
{
|
|
/// <summary>
|
|
/// Authoring for a Blight-clutter ghost prefab (ownerless interpolated — duplicate from ResourceNode.prefab
|
|
/// so the GhostAuthoringComponent comes free). Bakes <see cref="BlightClutter"/> + <see cref="HitRadius"/>
|
|
/// (reused for the harvest/clear sweep) + <see cref="RegionTag"/>{Expedition} so GhostRelevancy scopes it to
|
|
/// expedition players. The field spawner overrides Variant (round-robin) + Position per instance. Defaults are
|
|
/// inline here (mirrors ResourceNodeAuthoring), not in Tuning.
|
|
/// </summary>
|
|
public class BlightClutterAuthoring : MonoBehaviour
|
|
{
|
|
[Tooltip("Hit-points before the clutter shatters.")]
|
|
[Min(1)] public int Remaining = 8;
|
|
|
|
[Tooltip("Scrap (Biomass) yielded per projectile hit — the 'minor scrap' trickle.")]
|
|
[Min(1f)] public float ScrapPerHit = 2f;
|
|
|
|
[Tooltip("Hit radius (world units) for the clear sweep.")]
|
|
[Min(0f)] public float HitRadius = 1.0f;
|
|
|
|
[Tooltip("Default visual variant (the spawner round-robins this per piece).")]
|
|
public byte Variant = 0;
|
|
|
|
private class BlightClutterBaker : Baker<BlightClutterAuthoring>
|
|
{
|
|
public override void Bake(BlightClutterAuthoring authoring)
|
|
{
|
|
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
|
|
AddComponent(entity, new BlightClutter
|
|
{
|
|
Remaining = authoring.Remaining,
|
|
Variant = authoring.Variant,
|
|
ScrapResourceId = ResourceId.Biomass,
|
|
ScrapPerHit = authoring.ScrapPerHit,
|
|
});
|
|
AddComponent(entity, new HitRadius { Value = authoring.HitRadius });
|
|
AddComponent(entity, new RegionTag { Region = RegionId.Expedition });
|
|
}
|
|
}
|
|
}
|
|
}
|