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
|
|
@ -301,27 +301,6 @@ public class EntityInstance : MonoBehaviour
|
|||
{
|
||||
if (!this) return;
|
||||
_destroyed = true;
|
||||
foreach (var gear in Entity.Equipment)
|
||||
{
|
||||
if (gear != Entity.EquippedHull && Random.value < ZoneRenderer.Settings.LootDropProbability)
|
||||
{
|
||||
ZoneRenderer.DropItem(
|
||||
Entity.Position.ToUnity(),
|
||||
Random.onUnitSphere * ZoneRenderer.Settings.LootDropVelocity,
|
||||
gear.EquippableItem);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var cargo in Entity.CargoBays)
|
||||
{
|
||||
foreach (var item in cargo.Cargo.Keys)
|
||||
{
|
||||
ZoneRenderer.DropItem(
|
||||
Entity.Position.ToUnity(),
|
||||
Random.onUnitSphere * ZoneRenderer.Settings.LootDropVelocity,
|
||||
item);
|
||||
}
|
||||
}
|
||||
if (DestroyEffect != null)
|
||||
{
|
||||
var t = Instantiate(DestroyEffect).transform;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@ using UnityEngine;
|
|||
public class GameSettings : ScriptableObject
|
||||
{
|
||||
public string StartingHullName = "Longinus";
|
||||
public float PickupLifetime = 30;
|
||||
public float LootDropProbability = .25f;
|
||||
public float LootDropVelocity = 25;
|
||||
public float HeatstrokePhasingFloor = 0;
|
||||
public float HeatstrokePhasingFrequency = 5;
|
||||
public float WormholeDistanceRatio;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,40 +52,6 @@ public class ShieldManager : MonoBehaviour, IAbsorbPresenter
|
|||
Debug.LogWarning("ShieldManager has no ShieldEnvelope; falling back to its own transform for the hit direction.", this);
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other)
|
||||
{
|
||||
var otherShield = other.collider.GetComponent<ShieldManager>();
|
||||
if (!otherShield)
|
||||
{
|
||||
var gridObject = other.collider.GetComponent<GridObject>();
|
||||
if (gridObject)
|
||||
{
|
||||
var itemPickup = other.collider.GetComponent<ItemPickup>();
|
||||
if (itemPickup)
|
||||
{
|
||||
if (Entity.CargoBays.Any(c => c.TryStore(itemPickup.Item)))
|
||||
{
|
||||
// TODO: Pickup notification!
|
||||
Destroy(itemPickup.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Pickup failed notification!
|
||||
var cp = other.GetContact(0);
|
||||
gridObject.Velocity += cp.normal * 25;
|
||||
Debug.Log("Attempted item pickup, but no space in cargo bay!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Shield collision occurred with grid object, but other collider isn't an item pickup!");
|
||||
}
|
||||
}
|
||||
else
|
||||
Debug.Log("Shield collision occurred, but other collider isn't a shield or a grid object!");
|
||||
}
|
||||
}
|
||||
|
||||
// A shot the shield took ripples it where the shot landed, drawn on the hull as it is drawn. The hull layer is
|
||||
// ImpactPresenter's.
|
||||
public void Absorb(AbsorbEvent e)
|
||||
|
|
|
|||
|
|
@ -14,20 +14,9 @@ public class TractorBeam : MonoBehaviour
|
|||
public void Update()
|
||||
{
|
||||
transform.rotation = Quaternion.LookRotation(Direction);
|
||||
// The beam draws nothing until it presents a sim grab (loot-3): no particles, and no pull; the simulation
|
||||
// decides every floating item's motion.
|
||||
var emission = ParticleSystem.emission;
|
||||
if (Power > .01f)
|
||||
{
|
||||
var objectFound = false;
|
||||
foreach (var o in Physics.SphereCastAll(transform.position, Radius, Direction, Distance, 1 << 21))
|
||||
{
|
||||
var gridObject = o.collider.GetComponent<GridObject>();
|
||||
if (gridObject == null) continue;
|
||||
objectFound = true;
|
||||
gridObject.Velocity += Vector3.Normalize(transform.position - gridObject.transform.position) * (Traction * Time.deltaTime);
|
||||
}
|
||||
|
||||
emission.rateOverTimeMultiplier = objectFound ? Power : 0;
|
||||
}
|
||||
else emission.rateOverTimeMultiplier = 0;
|
||||
emission.rateOverTimeMultiplier = 0;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue