using UnityEngine; namespace Beyond { public class DestinationTargetManager : MonoBehaviour { public static DestinationTargetManager Instance; [Header("UI Elements")] [SerializeField] private NavigationIndicator navigationIndicator; [Header("Audio")] [SerializeField] private AudioClip destinationSound; // D�wi�k do odtworzenia [SerializeField] private AudioSource audioSource; // �r�d�o d�wi�ku [Header("Initial Target")] [SerializeField] private DestinationPoint initialTarget; // Pocz�tkowy punkt docelowy private DestinationPoint currentTarget; private void Awake() { if (Instance == null) { Instance = this; //DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } } private void Start() { // Ustaw pocz�tkowy cel, ale nie aktywuj go od razu SetInitialTarget(initialTarget); SetTargetVisibility(false); // Pocz�tkowy cel jest niewidoczny na pocz�tku } public void SwitchToNextPoint(DestinationPoint nextPoint) { if (nextPoint == null) return; // Dezaktywuj obecny cel if (currentTarget != null) { currentTarget.Deactivate(); } // Prze��cz na nast�pny punkt currentTarget = nextPoint; // Ustaw nowy cel na wska�niku if (navigationIndicator != null) { navigationIndicator.SetTargetTransform(currentTarget.transform); } // Aktywuj nowy punkt currentTarget.Activate(); // Odtw�rz d�wi�k, je�li jest przypisany if (destinationSound != null && audioSource != null) { audioSource.PlayOneShot(destinationSound); } } public void SetInitialTarget(DestinationPoint target) { if (target == null) return; currentTarget = target; // Ustaw pocz�tkowy cel na wska�niku, ale go nie aktywuj if (navigationIndicator != null) { navigationIndicator.SetTargetTransform(currentTarget.transform); } } // Nowa metoda do ustawiania widoczno�ci celu public void SetTargetVisibility(bool isVisible) { if (navigationIndicator != null) { if (isVisible) { navigationIndicator.SetTargetTransform(currentTarget.transform); } else { navigationIndicator.Deactivate(); } } } } }