using UnityEngine; // Tiny self-animating effect: squeezes the object's X/Z to nothing (and stretches Y) over // `duration`, then destroys it. Used for the target spawn beam. public class FxShrink : MonoBehaviour { public float duration = 0.45f; public float stretch = 1.6f; Vector3 startScale; float startTime; void Start() { startScale = transform.localScale; startTime = Time.time; } void Update() { float t = Mathf.Clamp01((Time.time - startTime) / duration); float squeeze = 1f - t * t; transform.localScale = new Vector3(startScale.x * squeeze, startScale.y * Mathf.Lerp(1f, stretch, t), startScale.z * squeeze); if (t >= 1f) Destroy(gameObject); } }