Core Game Loop Additions
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using ProjectM.Simulation;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProjectM.Authoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Authoring for the baked <see cref="ResourceFieldSpawner"/> singleton (mirrors StorageSpawnerAuthoring).
|
||||
/// Place once in the gameplay subscene and assign the resource-node ghost prefab; ExpeditionFieldSystem
|
||||
/// scatters the field each Expedition. Carries no transform.
|
||||
/// </summary>
|
||||
public class ResourceFieldSpawnerAuthoring : MonoBehaviour
|
||||
{
|
||||
[Tooltip("Resource-node ghost prefab. Must carry ResourceNodeAuthoring + a GhostAuthoringComponent (ownerless, interpolated).")]
|
||||
public GameObject NodePrefab;
|
||||
|
||||
[Tooltip("Number of nodes per expedition.")]
|
||||
[Min(1)] public int Count = 8;
|
||||
|
||||
[Tooltip("Scatter radius (world units) around the expedition origin.")]
|
||||
[Min(1f)] public float Radius = 12f;
|
||||
|
||||
private class ResourceFieldSpawnerBaker : Baker<ResourceFieldSpawnerAuthoring>
|
||||
{
|
||||
public override void Bake(ResourceFieldSpawnerAuthoring authoring)
|
||||
{
|
||||
var entity = GetEntity(authoring, TransformUsageFlags.None);
|
||||
AddComponent(entity, new ResourceFieldSpawner
|
||||
{
|
||||
Prefab = authoring.NodePrefab != null
|
||||
? GetEntity(authoring.NodePrefab, TransformUsageFlags.Dynamic)
|
||||
: Entity.Null,
|
||||
Count = authoring.Count,
|
||||
Radius = authoring.Radius,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user