e362aaeb43
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>
42 lines
1.6 KiB
C#
42 lines
1.6 KiB
C#
using Unity.Burst;
|
|
using Unity.Entities;
|
|
using Unity.Mathematics;
|
|
using Unity.NetCode;
|
|
using Unity.Transforms;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// Predicted aim/facing: writes <see cref="PlayerFacing"/> from twin-stick Aim, falling back to
|
|
/// the movement direction when Aim is zero (controller-first directional aim). Also turns the
|
|
/// ghost transform toward the facing direction for top-down presentation. When there is no input
|
|
/// this tick the previous facing is held. Deterministic (pure math); filtered to
|
|
/// <see cref="Simulate"/> so it runs only for predicted ghosts.
|
|
/// </summary>
|
|
[UpdateInGroup(typeof(PredictedSimulationSystemGroup))]
|
|
[BurstCompile]
|
|
public partial struct PlayerAimSystem : ISystem
|
|
{
|
|
[BurstCompile]
|
|
public void OnUpdate(ref SystemState state)
|
|
{
|
|
foreach (var (facing, transform, input) in
|
|
SystemAPI.Query<RefRW<PlayerFacing>, RefRW<LocalTransform>, RefRO<PlayerInput>>()
|
|
.WithAll<Simulate>().WithDisabled<Dead>())
|
|
{
|
|
float2 aim = input.ValueRO.Aim;
|
|
if (math.lengthsq(aim) < 1e-6f)
|
|
aim = input.ValueRO.Move; // fall back to movement heading
|
|
if (math.lengthsq(aim) < 1e-6f)
|
|
continue; // no input this tick: keep last facing
|
|
|
|
aim = math.normalize(aim);
|
|
facing.ValueRW.Direction = aim;
|
|
|
|
float3 forward = new float3(aim.x, 0f, aim.y);
|
|
transform.ValueRW.Rotation = quaternion.LookRotationSafe(forward, math.up());
|
|
}
|
|
}
|
|
}
|
|
}
|