Import art/VFX asset packs + game-feel systems; normalize texture extensions to lowercase for LFS
Add BefourStudios SciFi environment packs, Gabriel Aguiar VFX, and the ShaderCrew Toon Shader embedded packages, plus combat/enemy/wave/death gameplay systems and supporting vault docs/screenshots. Rename 11 vendor textures from uppercase .PNG/.HDR to lowercase so the case-sensitive Git LFS filters (*.png/*.hdr) match on case-sensitive filesystems (Linux CI, case-sensitive macOS), not just locally where core.ignorecase=true masks the gap. Each .meta moved with its asset so GUID references are preserved. All ~1000 binaries tracked via LFS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
using ProjectM.Simulation;
|
||||
using Unity.Burst;
|
||||
using Unity.Collections;
|
||||
using Unity.Entities;
|
||||
using Unity.Mathematics;
|
||||
using Unity.NetCode;
|
||||
using Unity.Transforms;
|
||||
|
||||
namespace ProjectM.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Server-only Husk wave/threat director: a state machine that escalates the swarm. In <c>Lull</c> it waits
|
||||
/// until the lull timer expires, then starts the next wave (count = <c>BaseCount + (wave-1)*CountPerWave</c>). In
|
||||
/// <c>Spawning</c> it spawns one Husk every <c>SpawnIntervalTicks</c> at a deterministic ring slot around the
|
||||
/// <see cref="BaseAnchor"/>, round-robin over the <see cref="WaveEnemyPrefab"/> pool, until the wave is fully
|
||||
/// spawned; then it waits for the field to be cleared (no live <see cref="EnemyTag"/>) before returning to
|
||||
/// <c>Lull</c>. Plain <see cref="SimulationSystemGroup"/>, server-authoritative (Husks are interpolated ghosts).
|
||||
/// Replaces the flat <c>EnemySpawnSystem</c> sustain. Tick gating uses the wrap-safe <see cref="NetworkTick"/>
|
||||
/// compare + <see cref="TickUtil.NonZero"/>.
|
||||
/// </summary>
|
||||
[BurstCompile]
|
||||
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation)]
|
||||
[UpdateInGroup(typeof(SimulationSystemGroup))]
|
||||
public partial struct WaveSystem : ISystem
|
||||
{
|
||||
EntityQuery m_AliveHusks;
|
||||
|
||||
[BurstCompile]
|
||||
public void OnCreate(ref SystemState state)
|
||||
{
|
||||
state.RequireForUpdate<WaveDirector>();
|
||||
state.RequireForUpdate<WaveState>();
|
||||
state.RequireForUpdate<NetworkTime>();
|
||||
m_AliveHusks = state.GetEntityQuery(ComponentType.ReadOnly<EnemyTag>());
|
||||
}
|
||||
|
||||
[BurstCompile]
|
||||
public void OnUpdate(ref SystemState state)
|
||||
{
|
||||
var serverTick = SystemAPI.GetSingleton<NetworkTime>().ServerTick;
|
||||
if (!serverTick.IsValid)
|
||||
return;
|
||||
uint now = serverTick.TickIndexForValidTick;
|
||||
|
||||
var director = SystemAPI.GetSingleton<WaveDirector>();
|
||||
var directorEntity = SystemAPI.GetSingletonEntity<WaveDirector>();
|
||||
var prefabs = SystemAPI.GetBuffer<WaveEnemyPrefab>(directorEntity);
|
||||
if (prefabs.Length == 0)
|
||||
return;
|
||||
|
||||
var wave = SystemAPI.GetComponent<WaveState>(directorEntity);
|
||||
|
||||
// Ring centre on the base plot when present.
|
||||
float3 center = new float3(0f, 1f, 0f);
|
||||
if (SystemAPI.TryGetSingleton<BaseAnchor>(out var baseAnchor))
|
||||
center = BaseGridMath.PlotCenter(baseAnchor);
|
||||
|
||||
// Due when no action is scheduled yet (NextActionTick 0) or the scheduled tick is at/behind now.
|
||||
bool dueNow = wave.NextActionTick == 0 || !new NetworkTick(wave.NextActionTick).IsNewerThan(serverTick);
|
||||
|
||||
if (wave.Phase == WavePhase.Lull)
|
||||
{
|
||||
if (dueNow)
|
||||
{
|
||||
// Start the next (bigger) wave.
|
||||
wave.WaveNumber += 1;
|
||||
wave.RemainingToSpawn =
|
||||
math.max(1, director.BaseCount + (wave.WaveNumber - 1) * director.CountPerWave);
|
||||
wave.Phase = WavePhase.Spawning;
|
||||
wave.NextActionTick = TickUtil.NonZero(now); // spawn the first Husk this tick
|
||||
}
|
||||
}
|
||||
else // Spawning
|
||||
{
|
||||
if (wave.RemainingToSpawn > 0)
|
||||
{
|
||||
if (dueNow)
|
||||
{
|
||||
int slots = math.max(1, director.RingSlots);
|
||||
int prefabIdx = wave.SpawnCounter % prefabs.Length;
|
||||
float3 pos = EnemyAIMath.RingPosition(center, wave.SpawnCounter, slots, director.RingRadius);
|
||||
pos.y = center.y;
|
||||
|
||||
var ecb = new EntityCommandBuffer(Allocator.Temp);
|
||||
var husk = ecb.Instantiate(prefabs[prefabIdx].Prefab);
|
||||
ecb.SetComponent(husk, LocalTransform.FromPosition(pos));
|
||||
ecb.Playback(state.EntityManager);
|
||||
ecb.Dispose();
|
||||
|
||||
wave.SpawnCounter += 1;
|
||||
wave.RemainingToSpawn -= 1;
|
||||
wave.NextActionTick = TickUtil.NonZero(now + (uint)math.max(1, director.SpawnIntervalTicks));
|
||||
}
|
||||
}
|
||||
else if (m_AliveHusks.CalculateEntityCount() == 0)
|
||||
{
|
||||
// Wave cleared: calm before the next.
|
||||
wave.Phase = WavePhase.Lull;
|
||||
wave.NextActionTick = TickUtil.NonZero(now + (uint)math.max(1, director.LullTicks));
|
||||
}
|
||||
}
|
||||
|
||||
SystemAPI.SetComponent(directorEntity, wave);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user