Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone
ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the lowering. GridObject and TimedDestroy were deleted infa911f2d, sofa911f2dand2565e2c5do not build in Unity. Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten). Builds: Unity batchmode compile green at this commit; dotnet green at2565e2c5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2565e2c5d7
commit
c7c7e58508
16 changed files with 576 additions and 252 deletions
|
|
@ -4,9 +4,15 @@ using CultMath;
|
|||
using CultMath.UnityBridge;
|
||||
using UnityEngine;
|
||||
using static CultMath.math;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
// How one floating item looks. Zone owns the item's every fact (existence, position, expiry, pickup); once bound,
|
||||
// this reads the latest sim body and draws, spun for show, and writes nothing back (rulings unity-presents-only-r3
|
||||
// and sim-speed-presentation). An unbound pickup (FieldTester's test scene) leaves its transform alone.
|
||||
public class ItemPickup : MonoBehaviour
|
||||
{
|
||||
public float RotationSpeed = 1f;
|
||||
public float GridOffset;
|
||||
public float LabelFadeDuration = .5f;
|
||||
public float LabelPersistDuration = 3;
|
||||
public float LabelDisplayAngle = 15;
|
||||
|
|
@ -15,14 +21,38 @@ public class ItemPickup : MonoBehaviour
|
|||
public TextMeshPro ScanLabel;
|
||||
|
||||
public ItemInstance Item { get; set; }
|
||||
public ZoneRenderer ZoneRenderer { get; set; }
|
||||
public float3 ViewOrigin { get; set; }
|
||||
public float3 ViewDirection { get; set; }
|
||||
|
||||
private float _displayTime;
|
||||
private float _timeOffset;
|
||||
private Zone _zone;
|
||||
private FloatingItem _floating;
|
||||
|
||||
public void Bind(Zone zone, FloatingItem floating)
|
||||
{
|
||||
_zone = zone;
|
||||
_floating = floating;
|
||||
Item = floating.Item;
|
||||
_timeOffset = Random.value * 100;
|
||||
Place();
|
||||
}
|
||||
|
||||
private void Place()
|
||||
{
|
||||
var p = _floating.Body.Position;
|
||||
transform.position = new Vector3(p.x, _zone.GetHeight(p) + GridOffset, p.y);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_floating != null)
|
||||
{
|
||||
Place();
|
||||
transform.localRotation = Quaternion.Euler(
|
||||
sin(Time.time - _timeOffset * RotationSpeed) * 90, 0, cos(Time.time - _timeOffset * RotationSpeed) * 90);
|
||||
}
|
||||
|
||||
var diff = transform.position.ToCultMath() - ViewOrigin;
|
||||
var toThis = normalize(diff);
|
||||
var viewAngle = acos(dot(toThis, ViewDirection)) * Mathf.Rad2Deg;
|
||||
|
|
@ -34,9 +64,4 @@ public class ItemPickup : MonoBehaviour
|
|||
ScanLabel.color = c;
|
||||
ScanLabelContainer.rotation = Quaternion.LookRotation((-toThis).ToUnity());
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ZoneRenderer?.DestroyLoot(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue