From f571fbf5807ebcaecc741b34a6c933449edc03c9 Mon Sep 17 00:00:00 2001 From: Ader Alisma 01 Date: Sun, 29 Jun 2025 17:44:15 -0400 Subject: [PATCH] Cleanup --- Assets/Scripts/Ally/AllyUpgrade.cs | 71 ------------------------- Assets/Scripts/Ally/AllyUpgrade.cs.meta | 11 ---- 2 files changed, 82 deletions(-) delete mode 100644 Assets/Scripts/Ally/AllyUpgrade.cs delete mode 100644 Assets/Scripts/Ally/AllyUpgrade.cs.meta diff --git a/Assets/Scripts/Ally/AllyUpgrade.cs b/Assets/Scripts/Ally/AllyUpgrade.cs deleted file mode 100644 index a0352af..0000000 --- a/Assets/Scripts/Ally/AllyUpgrade.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI; - -public class AllyUpgrade : MonoBehaviour, IPointerClickHandler -{ - [SerializeField] - private GameObject _upgradeUI; - [SerializeField] - private List _upgradeList = new List(); - private GameObject _instance = null; - - public void OnPointerClick(PointerEventData eventData) - { - if (eventData.button == 0) //Left click - { - if (!_instance) - { - GameObject sceneCanvas = GameObject.Find("Canvas"); - if (sceneCanvas != null) - { - Canvas canvas = sceneCanvas.GetComponent(); - if (canvas == null) - { - Debug.Log("Canvas introuvable..."); - } - else - { - _instance = Instantiate(_upgradeUI, Camera.main.WorldToScreenPoint(transform.position), Quaternion.identity, canvas.transform); - AssignUpgrades(canvas); - DeselectManager.Instance.SetAllyUpgrade(_instance); - } - } - } - else - { - Destroy(_instance); - _instance = null; - } - } - } - - private void AssignUpgrades(Canvas canvas) - { - // Assign upgrade Prefabs - for (int i = 0; i < _instance.transform.childCount - 1; i++) - { - if (_upgradeList.Count > i && _upgradeList[i] != null) - { - GameObject upgradeEnfant = _instance.transform.Find("Upgrade" + (i + 1)).gameObject; - if (upgradeEnfant.TryGetComponent(out UpgradePlacementButton button)) - { - button.Initialize(_upgradeList[i], gameObject, canvas); - //button.GetComponent().Select(); - //button.gameObject.AddComponent().Init(_instance); - } - } - } - } - - private void OnDestroy() - { - if (_instance != null) - { - Debug.Log("Destroying upgrade UI"); - Destroy(_instance); - _instance = null; - } - } -} diff --git a/Assets/Scripts/Ally/AllyUpgrade.cs.meta b/Assets/Scripts/Ally/AllyUpgrade.cs.meta deleted file mode 100644 index 389b93e..0000000 --- a/Assets/Scripts/Ally/AllyUpgrade.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: edcd1782caa73a747b1f060d18ce0f18 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: