This commit is contained in:
2026-07-07 20:51:18 -07:00
parent d2203c8aa1
commit cc2e7ad95e
20 changed files with 794 additions and 35 deletions
@@ -0,0 +1,205 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace ProjectM.Client
{
/// <summary>
/// EDITOR-ONLY live tuner for the "3D pixel art" full-screen render style — the
/// <c>Hidden/ProjectM/PixelOutline</c> shader driven by <c>PixelOutline.mat</c> via the
/// PC_Renderer <c>FullScreenPassRendererFeature</c>. Self-spawns on Play (no scene wiring),
/// so it works in Game.unity and DevSandbox.unity alike. Toggle the panel with <b>F3</b>.
///
/// It writes straight to the shared material ASSET, so every drag applies to the running
/// game instantly AND sticks after you exit Play mode (material assets aren't reverted the
/// way scene objects are). "Save Asset" force-writes to disk now; "Reset" restores the
/// shader's shipped defaults. Stripped from player builds (#if UNITY_EDITOR).
/// </summary>
public class PixelArtDevControls : MonoBehaviour
{
const string MaterialPath = "Assets/_Project/Shaders/PixelOutline.mat";
static PixelArtDevControls _instance;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void Bootstrap()
{
if (_instance != null)
return;
var go = new GameObject("~PixelArtDevControls") { hideFlags = HideFlags.HideAndDontSave };
DontDestroyOnLoad(go);
_instance = go.AddComponent<PixelArtDevControls>();
}
Material _mat;
bool _open;
Vector2 _scroll;
GUIStyle _wrap;
Material Mat
{
get
{
if (_mat == null)
_mat = AssetDatabase.LoadAssetAtPath<Material>(MaterialPath);
return _mat;
}
}
GUIStyle Wrap => _wrap ??= new GUIStyle(GUI.skin.label) { wordWrap = true, fontSize = 10 };
void OnDisable() => AimPresentation.ForceCursorVisible = false;
void Update()
{
if (Input.GetKeyDown(KeyCode.F3))
_open = !_open;
}
void OnGUI()
{
if (GUI.Button(new Rect(10, 10, 128, 24), _open ? "PIXEL ▲ (F3)" : "PIXEL ▼ (F3)"))
_open = !_open;
if (!_open)
return;
AimPresentation.ForceCursorVisible = true;
var mat = Mat;
if (mat == null)
{
GUILayout.BeginArea(new Rect(10, 40, 270, 64), GUI.skin.box);
GUILayout.Label("PixelOutline.mat not found at\n" + MaterialPath, Wrap);
GUILayout.EndArea();
return;
}
float panelH = Mathf.Min(660f, Screen.height - 60f);
GUILayout.BeginArea(new Rect(10, 40, 272, panelH), GUI.skin.box);
GUILayout.Label("PIXEL-ART RENDER STYLE (live)");
_scroll = GUILayout.BeginScrollView(_scroll);
Toggle(mat, "_MasterEnabled", "MASTER (whole effect on/off)");
GUILayout.Space(6);
GUILayout.Label("- Toggles -");
Toggle(mat, "_PixelateEnabled", "Pixelate");
Toggle(mat, "_PosterizeEnabled", "Posterize (banded color)");
Toggle(mat, "_DepthEdgesEnabled", "Depth edges (silhouette)");
Toggle(mat, "_NormalEdgesEnabled", "Normal edges (creases)");
GUILayout.Space(6);
GUILayout.Label("- Pixelation -");
Slider(mat, "_PixelHeight", "Grid height (px)", 40f, 720f, "0");
GUILayout.Space(6);
GUILayout.Label("- Color / tone -");
Slider(mat, "_ColorLevels", "Posterize levels", 2f, 64f, "0");
Slider(mat, "_Brightness", "Brightness", 0.5f, 2f, "0.00");
Slider(mat, "_Contrast", "Contrast", 0.5f, 2f, "0.00");
Slider(mat, "_Saturation", "Saturation", 0f, 2f, "0.00");
GUILayout.Space(6);
GUILayout.Label("- Outlines -");
Slider(mat, "_DepthThreshold", "Depth threshold", 0f, 1f, "0.000");
Slider(mat, "_NormalThreshold", "Normal threshold", 0f, 4f, "0.00");
Slider(mat, "_OutlineThickness", "Thickness (texels)", 0.25f, 4f, "0.00");
Slider(mat, "_EdgeStrength", "Edge strength", 0f, 1f, "0.00");
ColorRow(mat, "_OutlineColorOuter", "Silhouette color");
ColorRow(mat, "_OutlineColorInner", "Crease color");
GUILayout.Space(8);
GUILayout.BeginHorizontal();
if (GUILayout.Button("Reset defaults"))
ResetDefaults(mat);
if (GUILayout.Button("Save Asset"))
SaveAsset(mat);
GUILayout.EndHorizontal();
GUILayout.Label("Drags apply live and persist after Play. 'Save Asset' writes to disk now.", Wrap);
GUILayout.EndScrollView();
GUILayout.EndArea();
}
static void Toggle(Material mat, string prop, string label)
{
bool cur = mat.GetFloat(prop) > 0.5f;
bool now = GUILayout.Toggle(cur, " " + label);
if (now != cur)
{
mat.SetFloat(prop, now ? 1f : 0f);
EditorUtility.SetDirty(mat);
}
}
static void Slider(Material mat, string prop, string label, float min, float max, string fmt)
{
float cur = mat.GetFloat(prop);
GUILayout.BeginHorizontal();
GUILayout.Label(label, GUILayout.Width(126));
GUILayout.Label(cur.ToString(fmt), GUILayout.Width(48));
GUILayout.EndHorizontal();
float now = GUILayout.HorizontalSlider(cur, min, max);
if (!Mathf.Approximately(now, cur))
{
mat.SetFloat(prop, now);
EditorUtility.SetDirty(mat);
}
}
static void ColorRow(Material mat, string prop, string label)
{
Color c = mat.GetColor(prop);
GUILayout.Label(label);
Color n = c;
n.r = ChannelSlider("R", c.r);
n.g = ChannelSlider("G", c.g);
n.b = ChannelSlider("B", c.b);
if (n != c)
{
n.a = 1f;
mat.SetColor(prop, n);
EditorUtility.SetDirty(mat);
}
}
static float ChannelSlider(string label, float v)
{
GUILayout.BeginHorizontal();
GUILayout.Label(label, GUILayout.Width(14));
float r = GUILayout.HorizontalSlider(v, 0f, 1f);
GUILayout.EndHorizontal();
return r;
}
// Shipped defaults from PixelOutline.shader / .mat.
static void ResetDefaults(Material mat)
{
mat.SetFloat("_MasterEnabled", 1f);
mat.SetFloat("_PixelHeight", 200f);
mat.SetFloat("_PosterizeEnabled", 1f);
mat.SetFloat("_ColorLevels", 12f);
mat.SetFloat("_Brightness", 1.1f);
mat.SetFloat("_Contrast", 1.05f);
mat.SetFloat("_Saturation", 1.35f);
mat.SetFloat("_DepthThreshold", 0.08f);
mat.SetFloat("_NormalThreshold", 1f);
mat.SetFloat("_OutlineThickness", 1f);
mat.SetFloat("_EdgeStrength", 1f);
mat.SetFloat("_PixelateEnabled", 1f);
mat.SetFloat("_DepthEdgesEnabled", 1f);
mat.SetFloat("_NormalEdgesEnabled", 1f);
mat.SetColor("_OutlineColorOuter", Color.black);
mat.SetColor("_OutlineColorInner", Color.black);
EditorUtility.SetDirty(mat);
}
static void SaveAsset(Material mat)
{
EditorUtility.SetDirty(mat);
AssetDatabase.SaveAssetIfDirty(mat);
}
}
}
#endif
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e197a9add2f5e9845bac0bddd950232a
@@ -0,0 +1,184 @@
using System.Collections.Generic;
using ProjectM.Simulation;
using Unity.Entities;
using Unity.Mathematics;
using Unity.NetCode;
using Unity.Transforms;
using UnityEngine;
using UnityEngine.UIElements;
namespace ProjectM.Client
{
/// <summary>
/// Client-only ENEMY VISIBILITY markers — makes living enemies (especially the last one) easy to find so a room
/// never devolves into hunting an unseen straggler. Observe-only presentation <see cref="SystemBase"/> in
/// <see cref="PresentationSystemGroup"/> (same shape as <see cref="OnboardingSystem"/> / <see cref="HudSystem"/>:
/// reads replicated state, never mutates the sim, never destroys a ghost). Owns its own runtime UIDocument
/// (sortingOrder 48 — just under the HUD's 50) and a POOL of marker glyphs: each living enemy within
/// <see cref="FeelConfig.EnemyMarkerRange"/> of the local player gets either a clamped EDGE ARROW when off-screen
/// (rotated toward it — the "it's over here" cue, reusing OnboardingSystem's WorldToScreen edge math) or a subtle
/// overhead PIP when on-screen. The pips fade toward <see cref="FeelConfig.EnemyMarkerMinAlpha"/> as the on-screen
/// enemy count rises (declutter a swarm); off-screen arrows always stay full so a straggler is never missed. The
/// boss is excluded (it has its own HUD presence bar); corpses (<see cref="Dying"/>) are excluded.
/// </summary>
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
[UpdateInGroup(typeof(PresentationSystemGroup))]
public partial class EnemyMarkerSystem : SystemBase
{
const int MaxMarkers = 32; // pool cap (a room never fields this many; when few remain, all are marked)
const float Margin = 48f; // screen-edge inset for off-screen arrows (panel units)
GameObject _go;
UIDocument _doc;
bool _built;
readonly List<Label> _pool = new();
readonly List<float3> _positions = new();
protected override void OnStartRunning()
{
if (_go != null) return;
_go = new GameObject("~EnemyMarkers");
_doc = _go.AddComponent<UIDocument>();
_doc.panelSettings = MenuUi.LoadPanelSettings();
_doc.sortingOrder = 48; // just below the HUD (50)
}
protected override void OnDestroy()
{
if (_go != null) Object.Destroy(_go);
}
protected override void OnUpdate()
{
if (_doc == null) return;
var root = _doc.rootVisualElement;
if (root == null) return;
if (!_built)
{
root.style.position = Position.Absolute;
root.style.left = 0; root.style.right = 0; root.style.top = 0; root.style.bottom = 0;
root.pickingMode = PickingMode.Ignore; // never eat world clicks
_built = true;
}
var cam = Camera.main;
if (!FeelConfig.EnemyMarkerEnabled || cam == null)
{
HideFrom(0);
return;
}
// Local player position (range gate — scopes markers to the current room / region).
bool haveLocal = false; float3 localPos = default;
foreach (var lt in SystemAPI.Query<RefRO<LocalTransform>>().WithAll<GhostOwnerIsLocal, PlayerTag>())
{ haveLocal = true; localPos = lt.ValueRO.Position; break; }
// Collect living enemies within range (nearest-capped by MaxMarkers).
_positions.Clear();
float rangeSq = FeelConfig.EnemyMarkerRange * FeelConfig.EnemyMarkerRange;
foreach (var lt in SystemAPI.Query<RefRO<LocalTransform>>().WithAll<EnemyTag>().WithNone<Dying, BossState>())
{
float3 p = lt.ValueRO.Position;
if (haveLocal && math.distancesq(p, localPos) > rangeSq) continue;
_positions.Add(p);
if (_positions.Count >= MaxMarkers) break;
}
float pw = root.layout.width, ph = root.layout.height;
if (pw <= 1f || ph <= 1f) { HideFrom(0); return; }
// First pass: how many are on-screen (drives the pip declutter fade).
int onScreen = 0;
for (int i = 0; i < _positions.Count; i++)
if (!IsOffScreen(cam, _positions[i], pw, ph)) onScreen++;
int fadeStart = math.max(1, FeelConfig.EnemyMarkerFadeStartCount);
float pipAlpha = math.lerp(1f, math.clamp(FeelConfig.EnemyMarkerMinAlpha, 0f, 1f),
math.saturate((onScreen - fadeStart) / (float)fadeStart));
// Second pass: place each marker.
Color baseCol = FeelConfig.EnemyMarkerColor;
float size = FeelConfig.EnemyMarkerSize;
for (int i = 0; i < _positions.Count; i++)
{
var lbl = GetMarker(i, root);
Place(lbl, cam, _positions[i], pw, ph, baseCol, size, pipAlpha);
}
HideFrom(_positions.Count);
}
bool IsOffScreen(Camera cam, float3 world, float pw, float ph)
{
Vector3 sp = cam.WorldToScreenPoint((Vector3)world);
bool behind = sp.z < 0f;
float px = (sp.x / Mathf.Max(1f, Screen.width)) * pw;
float py = (1f - sp.y / Mathf.Max(1f, Screen.height)) * ph;
if (behind) { px = pw - px; py = ph - py; }
return behind || px < Margin || px > pw - Margin || py < Margin || py > ph - Margin;
}
void Place(Label lbl, Camera cam, float3 world, float pw, float ph, Color baseCol, float size, float pipAlpha)
{
Vector3 sp = cam.WorldToScreenPoint((Vector3)world);
bool behind = sp.z < 0f;
float px = (sp.x / Mathf.Max(1f, Screen.width)) * pw;
float py = (1f - sp.y / Mathf.Max(1f, Screen.height)) * ph;
if (behind) { px = pw - px; py = ph - py; }
bool off = behind || px < Margin || px > pw - Margin || py < Margin || py > ph - Margin;
float cx = pw * 0.5f, cy = ph * 0.5f;
float dx = px - cx, dy = py - cy;
float len = Mathf.Sqrt(dx * dx + dy * dy);
if (len < 0.001f) { dx = 0f; dy = -1f; len = 1f; }
float ndx = dx / len, ndy = dy / len;
lbl.style.fontSize = size;
if (off)
{
// Clamp to the margin rectangle along the center->enemy ray, rotate a triangle toward it.
float tx = (ndx > 0 ? (pw - Margin - cx) : (Margin - cx)) / (Mathf.Abs(ndx) < 1e-4f ? (ndx < 0 ? -1e-4f : 1e-4f) : ndx);
float ty = (ndy > 0 ? (ph - Margin - cy) : (Margin - cy)) / (Mathf.Abs(ndy) < 1e-4f ? (ndy < 0 ? -1e-4f : 1e-4f) : ndy);
float tt = Mathf.Min(Mathf.Abs(tx), Mathf.Abs(ty));
float ax = cx + ndx * tt, ay = cy + ndy * tt;
float angle = Mathf.Atan2(dy, dx) * Mathf.Rad2Deg; // "▶" points +x at 0 deg
lbl.text = "▶";
lbl.style.left = ax - size * 0.5f;
lbl.style.top = ay - size * 0.5f;
lbl.style.rotate = new StyleRotate(new Rotate(new Angle(angle)));
lbl.style.color = new Color(baseCol.r, baseCol.g, baseCol.b, baseCol.a); // arrows stay full alpha
}
else
{
// Overhead pip pointing down at the enemy; fades when the screen is crowded.
lbl.text = "▾";
lbl.style.left = px - size * 0.5f;
lbl.style.top = py - size - 20f; // float above the enemy
lbl.style.rotate = new StyleRotate(new Rotate(new Angle(0f)));
lbl.style.color = new Color(baseCol.r, baseCol.g, baseCol.b, baseCol.a * pipAlpha);
}
lbl.style.display = DisplayStyle.Flex;
}
Label GetMarker(int i, VisualElement root)
{
while (_pool.Count <= i)
{
var l = new Label("▶");
l.style.position = Position.Absolute;
l.style.unityFontStyleAndWeight = FontStyle.Bold;
l.style.unityTextAlign = TextAnchor.MiddleCenter;
l.pickingMode = PickingMode.Ignore;
l.style.display = DisplayStyle.None;
root.Add(l);
_pool.Add(l);
}
return _pool[i];
}
void HideFrom(int start)
{
for (int i = start; i < _pool.Count; i++)
_pool[i].style.display = DisplayStyle.None;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5b754936521bd1443b6daa41a9ae0fc8
@@ -161,6 +161,20 @@ namespace ProjectM.Client
public static float StrikeBeepMaxDistSq;
// ---- Enemy visibility markers (EnemyMarkerSystem: off-screen edge arrows + on-screen overhead pips) ----
/// <summary>Master gate for the enemy visibility markers.</summary>
public static bool EnemyMarkerEnabled;
/// <summary>Only mark living enemies within this world distance of the local player (scopes to the current room; avoids cross-region arrow spam).</summary>
public static float EnemyMarkerRange;
/// <summary>On-screen enemy count above which the overhead pips fade toward EnemyMarkerMinAlpha (declutter a swarm; off-screen arrows stay full).</summary>
public static int EnemyMarkerFadeStartCount;
/// <summary>Faded pip alpha once the on-screen count is well past EnemyMarkerFadeStartCount.</summary>
public static float EnemyMarkerMinAlpha;
/// <summary>Marker tint (pip + off-screen arrow).</summary>
public static Color EnemyMarkerColor;
/// <summary>Marker glyph font size (px).</summary>
public static float EnemyMarkerSize;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
public static void ResetDefaults()
{
@@ -240,6 +254,13 @@ namespace ProjectM.Client
StrikeBeepLeadTicks = 8;
StrikeBeepMaxDistSq = 225f; // 15 m
// Enemy visibility markers (EnemyMarkerSystem)
EnemyMarkerEnabled = true;
EnemyMarkerRange = 140f;
EnemyMarkerFadeStartCount = 6;
EnemyMarkerMinAlpha = 0.28f;
EnemyMarkerColor = new Color(1f, 0.86f, 0.3f, 1f); // warm amber, reads over the cool world
EnemyMarkerSize = 24f;
}
}
}
@@ -0,0 +1,103 @@
using System.Collections.Generic;
using ProjectM.Simulation;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
namespace ProjectM.Client
{
/// <summary>
/// Client-only harvest BODY feedback for resource nodes + Blight clutter — the "you're mining this down" cue that
/// complements <see cref="WorldFeedbackSystem"/>'s chip particles/SFX. Observe-only presentation (SystemBase, main
/// thread, no Burst) in <see cref="PresentationSystemGroup"/>: it edge-detects each node/clutter ghost's replicated
/// <c>Remaining</c> and drives a CLIENT-OWNED <see cref="PostTransformMatrix"/> scale on the ghost root so the node
/// (1) SHRINKS as Remaining falls toward 0 and (2) POPS briefly larger on each hit — a clear per-hit reaction plus
/// a running "how much is left" read. PostTransformMatrix composes on top of the replicated LocalTransform and is
/// NOT a ghost field, so this is pure client cosmetics: no wire change, no sim mutation, and it never destroys a
/// ghost (GhostDespawnSystem owns despawn; the shatter burst is WorldFeedbackSystem's prune path). Uses a scale
/// reaction rather than a <c>_BaseColor</c> flash because node materials (unlike the white-based enemy/player
/// bodies) aren't guaranteed white, so a base-color override could clobber their rest tint. Knobs in
/// <see cref="WorldFeelConfig"/> (<c>NodeMinScale</c> / <c>NodeHitPopScale</c> / <c>NodePopDurationSec</c>).
/// </summary>
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
[UpdateInGroup(typeof(PresentationSystemGroup))]
public partial class NodeFeedbackSystem : SystemBase
{
class Entry
{
public int LastRemaining;
public int MaxRemaining; // client "full" reference = the largest Remaining ever seen for this node
public float Pop; // 1 on a fresh hit, decays to 0 (the per-hit scale-up)
}
readonly Dictionary<Entity, Entry> _tracked = new();
readonly HashSet<Entity> _seen = new();
readonly List<Entity> _stale = new();
protected override void OnUpdate()
{
if (!WorldFeelConfig.Enabled) { RestoreAll(); return; }
float dt = SystemAPI.Time.DeltaTime;
EntityManager.CompleteDependencyBeforeRO<ResourceNode>();
EntityManager.CompleteDependencyBeforeRO<BlightClutter>();
_seen.Clear();
var ecb = new EntityCommandBuffer(Unity.Collections.Allocator.Temp);
float popDecay = dt / math.max(0.01f, WorldFeelConfig.NodePopDurationSec);
float minScale = math.clamp(WorldFeelConfig.NodeMinScale, 0.05f, 1f);
float popAmt = math.max(0f, WorldFeelConfig.NodeHitPopScale);
foreach (var (node, entity) in SystemAPI.Query<RefRO<ResourceNode>>().WithEntityAccess())
Drive(entity, node.ValueRO.Remaining, popDecay, minScale, popAmt, ecb);
foreach (var (clut, entity) in SystemAPI.Query<RefRO<BlightClutter>>().WithEntityAccess())
Drive(entity, clut.ValueRO.Remaining, popDecay, minScale, popAmt, ecb);
ecb.Playback(EntityManager);
ecb.Dispose();
// Prune despawned (depleted/shattered) nodes — their PostTransformMatrix dies with the ghost.
if (_tracked.Count != _seen.Count)
{
_stale.Clear();
foreach (var kv in _tracked) if (!_seen.Contains(kv.Key)) _stale.Add(kv.Key);
for (int i = 0; i < _stale.Count; i++) _tracked.Remove(_stale[i]);
}
}
void Drive(Entity e, int remaining, float popDecay, float minScale, float popAmt, EntityCommandBuffer ecb)
{
_seen.Add(e);
if (!_tracked.TryGetValue(e, out var entry))
{
entry = new Entry { LastRemaining = remaining, MaxRemaining = math.max(1, remaining), Pop = 0f };
_tracked[e] = entry;
if (!EntityManager.HasComponent<PostTransformMatrix>(e))
ecb.AddComponent(e, new PostTransformMatrix { Value = float4x4.Scale(1f) }); // present next frame
}
else
{
if (remaining < entry.LastRemaining) entry.Pop = 1f; // a hit landed
entry.LastRemaining = remaining;
if (remaining > entry.MaxRemaining) entry.MaxRemaining = remaining;
}
entry.Pop = math.max(0f, entry.Pop - popDecay);
// Progressive shrink toward NodeMinScale as Remaining -> 0, plus a brief per-hit pop.
float frac = math.saturate(remaining / (float)math.max(1, entry.MaxRemaining));
float scale = math.lerp(minScale, 1f, frac) * (1f + entry.Pop * popAmt);
if (EntityManager.HasComponent<PostTransformMatrix>(e))
EntityManager.SetComponentData(e, new PostTransformMatrix { Value = float4x4.Scale(scale) });
}
// Toggled off (WorldFeelConfig.Enabled=false) -> restore every tracked node to full size and stop tracking.
void RestoreAll()
{
foreach (var kv in _tracked)
if (EntityManager.Exists(kv.Key) && EntityManager.HasComponent<PostTransformMatrix>(kv.Key))
EntityManager.SetComponentData(kv.Key, new PostTransformMatrix { Value = float4x4.Scale(1f) });
_tracked.Clear();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1fca48a6fde1ed94b9f2445b4d9c73d3
@@ -81,7 +81,7 @@ namespace ProjectM.Client
SystemAPI.Query<RefRO<ResourceNode>, RefRO<LocalTransform>>().WithEntityAccess())
{
_seen.Add(e);
Observe(e, node.ValueRO.Remaining, xf.ValueRO.Position, false, TintForResource(node.ValueRO.ResourceId));
Observe(e, node.ValueRO.Remaining, xf.ValueRO.Position, false, TintForResource(node.ValueRO.ResourceId), haveLocal && math.distancesq(xf.ValueRO.Position, localPos) <= WorldFeelConfig.ProximityRange * WorldFeelConfig.ProximityRange);
}
// Blight clutter — chip on damage.
@@ -89,7 +89,7 @@ namespace ProjectM.Client
SystemAPI.Query<RefRO<BlightClutter>, RefRO<LocalTransform>>().WithEntityAccess())
{
_seen.Add(e);
Observe(e, clutter.ValueRO.Remaining, xf.ValueRO.Position, true, WorldFeelConfig.WildTint);
Observe(e, clutter.ValueRO.Remaining, xf.ValueRO.Position, true, WorldFeelConfig.WildTint, haveLocal && math.distancesq(xf.ValueRO.Position, localPos) <= WorldFeelConfig.ProximityRange * WorldFeelConfig.ProximityRange);
}
// Prune: a despawn = the server destroyed it (node depleted / clutter shattered). Gate on proximity so
@@ -119,12 +119,17 @@ namespace ProjectM.Client
}
}
void Observe(Entity e, int remaining, float3 pos, bool isClutter, Color tint)
void Observe(Entity e, int remaining, float3 pos, bool isClutter, Color tint, bool nearLocal)
{
if (_cache.TryGetValue(e, out var prev) && remaining < prev.Remaining)
{
EmitTinted(_chipFx, (Vector3)pos + Vector3.up * 0.6f, WorldFeelConfig.ChipBurstCount, tint);
PlayClip(_chipClip, (Vector3)pos, WorldFeelConfig.ChipSfxVolume);
if (nearLocal) // tiny per-hit camera impact, only for harvesting near the local player (not a teammate's far node)
{
if (WorldFeelConfig.ChipFovKick > 0f) PrototypeCameraRig.PunchFov(WorldFeelConfig.ChipFovKick, 90f);
if (WorldFeelConfig.ChipShake > 0f) PrototypeCameraRig.AddShake(WorldFeelConfig.ChipShake);
}
}
_cache[e] = new Cache { Remaining = remaining, Pos = pos, IsClutter = isClutter, Tint = tint };
}
@@ -42,13 +42,25 @@ namespace ProjectM.Client
/// <summary>Tint for Biomass-node chips (HDR sickly green).</summary>
public static Color BiomassTint;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
public static void ResetDefaults()
// ---- Node harvest BODY feedback (NodeFeedbackSystem: client-only PostTransformMatrix scale). ----
/// <summary>Smallest a node/clutter shrinks to just before it depletes (fraction of its full size).</summary>
public static float NodeMinScale;
/// <summary>Brief extra scale-up on each harvest hit (the per-hit "reaction" pop); decays over NodePopDurationSec.</summary>
public static float NodeHitPopScale;
/// <summary>Seconds for the per-hit scale-pop to decay back.</summary>
public static float NodePopDurationSec;
/// <summary>Tiny camera FOV kick per harvest hit near the player (impact); 0 = off.</summary>
public static float ChipFovKick;
/// <summary>Tiny camera shake per harvest hit near the player.</summary>
public static float ChipShake;
public static void ResetDefaults()
{
Enabled = true;
ChipBurstCount = 6;
ClearBurstCount = 18;
ChipSfxVolume = 0.30f;
ChipBurstCount = 12; // beefed from 6 -> a clearly visible chip spray per harvest hit
ClearBurstCount = 22;
ChipSfxVolume = 0.42f; // beefed from 0.30 -> a punchier "tink"
ClearSfxVolume = 0.55f;
ClearFovKick = 0.8f;
ClearShake = 0.12f;
@@ -56,6 +68,11 @@ namespace ProjectM.Client
WildTint = new Color(3.0f, 1.1f, 0.25f);
OreTint = new Color(2.6f, 1.9f, 0.7f);
BiomassTint = new Color(0.9f, 2.4f, 0.8f);
NodeMinScale = 0.35f; // node shrinks to ~1/3 size as it nears depletion
NodeHitPopScale = 0.16f; // brief +16% pop on each hit
NodePopDurationSec = 0.16f;
ChipFovKick = 0.35f; // subtle per-hit camera impact near the player
ChipShake = 0.05f;
}
}
}