using System; using KBCore.Refs; using UnityEngine; namespace Infrastructure.Unity { public class OrbViewAdapter : MonoBehaviour { [SerializeField] private ParticleSystem pickupVfx; [Self][SerializeField] private MeshRenderer meshRenderer; public event Action OnCollected; private void OnTriggerEnter(Collider other) { if (other.TryGetComponent(out var player)) { if (pickupVfx) { var vfx = Instantiate(pickupVfx, transform.position, Quaternion.identity); var main = vfx.main; var currentColor = meshRenderer.material.color; main.startColor = currentColor; Destroy(vfx.gameObject, 2f); } OnCollected?.Invoke(); Destroy(gameObject); } } } }