21a4c71413
- KnockbackUtil.Stamp: shared knockback-stamp used by AbilityFireSystem + MeleeComboSystem (guard + planar normalize + write; speed passed in). - BakerStructureExt: AddPlacedStructure/AddDamageable extensions on Baker<T>; rewired Turret/Structure/Harvester/Conveyor/Fabricator bakers (baked data + serialized fields unchanged). - EnemyPrefabBakeExt.AddEnemyPrefabPool: shared prefab-buffer bake for ZoneEnemyDirector/WaveDirector authoring (fields stay flat — no serialization change). - Editor AnimRigUtil (HasParam + root-yaw overlay clip) shared by PlayerRigTools/EnemyRigTools; EnemyRigTools.MakeMat now GUID-preserving (CopySerialized over existing) — the composite AnimatorController copy left as-is with a caveat comment. 466/466 EditMode tests pass, 0 warnings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
1.3 KiB
C#
32 lines
1.3 KiB
C#
using System;
|
|
using Unity.Entities;
|
|
using UnityEngine;
|
|
|
|
namespace ProjectM.Authoring
|
|
{
|
|
/// <summary>
|
|
/// Shared BAKE step for the two enemy directors (Wave + Zone): add the prefab-pool buffer and fill it from the
|
|
/// authoring GameObject[] exactly as before — always add the (possibly empty) buffer, skip null entries, and
|
|
/// GetEntity(prefab, Dynamic) per entry. The element type differs per director (WaveEnemyPrefab vs
|
|
/// ZoneEnemyPrefab), so the caller supplies a tiny factory wrapping the resolved Entity in its element struct;
|
|
/// nothing about the serialized inspector fields or the baked buffer contents changes.
|
|
/// </summary>
|
|
public static class EnemyPrefabBakeExt
|
|
{
|
|
public static void AddEnemyPrefabPool<TAuthoring, TElem>(
|
|
this Baker<TAuthoring> baker, Entity e, GameObject[] prefabs, Func<Entity, TElem> make)
|
|
where TAuthoring : Component
|
|
where TElem : unmanaged, IBufferElementData
|
|
{
|
|
var buffer = baker.AddBuffer<TElem>(e);
|
|
if (prefabs == null)
|
|
return;
|
|
foreach (var prefab in prefabs)
|
|
{
|
|
if (prefab != null)
|
|
buffer.Add(make(baker.GetEntity(prefab, TransformUsageFlags.Dynamic)));
|
|
}
|
|
}
|
|
}
|
|
}
|