Guided rounds follow the committed burst and resolution; no-target launcher no longer throws
- GuidedProjectileManager passed target.transform to OnFireGuided for a no-target fused round: a NullReferenceException inside InstantWeapon.Execute after the shot was queued, which skipped audio, wear, heat and visibility and unwound Zone.Update. The tuple's transform is null-safe now, and the trackmissile console command falls back to the missile. - Presentation follows the commit rather than predicting it. The manager binds each guided round to Zone.ShotCommitted (retarget to the burst point the commit names, so a Contact round bursts at its hull and a Range-clamped burst is not overshot) and ShotResolved (burst there, then). The binding is disposed when the projectile dies, so a pooled round does not accumulate them. - Beams and barrel-fired projectiles stay with F5. Unity-only; compile-checked by reading. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
24b4071b69
commit
543edee358
3 changed files with 43 additions and 2 deletions
|
|
@ -48,6 +48,31 @@ public class GuidedProjectile : MonoBehaviour
|
|||
|
||||
public event Action OnKill;
|
||||
|
||||
// The simulation's verdict on this round, bound by GuidedProjectileManager to Zone.ShotCommitted and
|
||||
// ShotResolved for its ShotId: this object flies and looks, and neither decides where the round bursts nor when.
|
||||
public IDisposable Binding { get; set; }
|
||||
|
||||
// The commit named a burst point: fly to it, whatever this round was homing on (a target it would have
|
||||
// passed, or a Range clamp it would have overshot).
|
||||
public void BurstAt(Vector3 point)
|
||||
{
|
||||
Target = null;
|
||||
TargetPosition = () => point;
|
||||
}
|
||||
|
||||
// The resolution: the round bursts now, at the simulation's burst point when it has one.
|
||||
public void Resolve(Vector3? point)
|
||||
{
|
||||
if (!_alive || !_active) return;
|
||||
if (point.HasValue) transform.position = point.Value;
|
||||
if (HitEffect != null)
|
||||
{
|
||||
var ht = HitEffect.Instantiate<Transform>();
|
||||
ht.position = transform.position;
|
||||
}
|
||||
StartCoroutine(Kill());
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
_active = _alive = true;
|
||||
|
|
@ -170,6 +195,8 @@ public class GuidedProjectile : MonoBehaviour
|
|||
|
||||
IEnumerator Kill()
|
||||
{
|
||||
Binding?.Dispose();
|
||||
Binding = null;
|
||||
_active = false;
|
||||
_alive = false;
|
||||
Particles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
||||
|
|
|
|||
Loading…
Reference in a new issue