Map Updates
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using ProjectM.Simulation;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProjectM.Authoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic authoring for a non-functional build-structure ghost prefab (Wall / Pylon) — duplicate
|
||||
/// Turret.prefab so the ownerless interpolated GhostAuthoringComponent on PlacedStructure.Type comes free,
|
||||
/// then swap TurretAuthoring for this. Bakes ONLY <see cref="PlacedStructure"/>{Type=<see cref="Kind"/>}
|
||||
/// (no <see cref="Turret"/> stats, so TurretFireSystem ignores it). BuildPlaceSystem overrides Cell +
|
||||
/// LastProcessedTick and adds RegionTag{Base} at placement. <see cref="Kind"/> is a byte (StructureType.*) to
|
||||
/// dodge the cross-assembly enum-in-Burst hazard and the MCP enum-drop gotcha.
|
||||
/// </summary>
|
||||
public class StructureAuthoring : MonoBehaviour
|
||||
{
|
||||
[Tooltip("StructureType byte: 5 = Wall, 6 = Pylon (do NOT use 1-4: Turret + reserved M7 automation).")]
|
||||
public byte Kind = StructureType.Wall;
|
||||
|
||||
private class StructureBaker : Baker<StructureAuthoring>
|
||||
{
|
||||
public override void Bake(StructureAuthoring authoring)
|
||||
{
|
||||
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
|
||||
AddComponent(entity, new PlacedStructure
|
||||
{
|
||||
Type = authoring.Kind,
|
||||
Cell = default,
|
||||
NextTick = 0u,
|
||||
LastProcessedTick = 0u,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f03349205fb1fe43bf6aaff14fce0b7
|
||||
@@ -20,6 +20,18 @@ namespace ProjectM.Authoring
|
||||
[Tooltip("Ore cost to build a turret.")]
|
||||
[Min(0)] public int TurretCostOre = 10;
|
||||
|
||||
[Tooltip("Wall structure ghost prefab (StructureAuthoring{Wall} + GhostAuthoring).")]
|
||||
public GameObject WallPrefab;
|
||||
|
||||
[Tooltip("Ore cost to build a wall.")]
|
||||
[Min(0)] public int WallCostOre = 4;
|
||||
|
||||
[Tooltip("Pylon cosmetic-beacon ghost prefab (StructureAuthoring{Pylon} + GhostAuthoring).")]
|
||||
public GameObject PylonPrefab;
|
||||
|
||||
[Tooltip("Ore cost to build a pylon.")]
|
||||
[Min(0)] public int PylonCostOre = 2;
|
||||
|
||||
private class StructureCatalogBaker : Baker<StructureCatalogAuthoring>
|
||||
{
|
||||
public override void Bake(StructureCatalogAuthoring authoring)
|
||||
@@ -38,6 +50,28 @@ namespace ProjectM.Authoring
|
||||
CostAmount = authoring.TurretCostOre,
|
||||
});
|
||||
}
|
||||
if (authoring.WallPrefab != null)
|
||||
{
|
||||
buf.Add(new StructureCatalogEntry
|
||||
{
|
||||
Type = StructureType.Wall,
|
||||
Prefab = GetEntity(authoring.WallPrefab, TransformUsageFlags.Dynamic),
|
||||
CostResourceId = ResourceId.Ore,
|
||||
CostAmount = authoring.WallCostOre,
|
||||
});
|
||||
}
|
||||
|
||||
if (authoring.PylonPrefab != null)
|
||||
{
|
||||
buf.Add(new StructureCatalogEntry
|
||||
{
|
||||
Type = StructureType.Pylon,
|
||||
Prefab = GetEntity(authoring.PylonPrefab, TransformUsageFlags.Dynamic),
|
||||
CostResourceId = ResourceId.Ore,
|
||||
CostAmount = authoring.PylonCostOre,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user