using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class UIPopupController : MonoBehaviour { [SerializeField] private RectTransform _root; [SerializeField] private RectTransform _spawnPoint; [SerializeField] private List _UIPairs = new List(); public void SpawnPopup(string message, UIMagnetType type, Action onComplete = null) { var selectedPair = _UIPairs.Find(x => x.UIMagnetType == type); var scorePoint = Instantiate(selectedPair.Popup, _root); scorePoint.Init(message); scorePoint.GetComponent().anchoredPosition = _spawnPoint.anchoredPosition; RectTransform target = selectedPair.MovePositon; scorePoint.GetComponent().LeanMoveLocal(target.anchoredPosition, 1).setOnComplete(onComplete).setEaseInExpo().setDestroyOnComplete(true); } }