Debuggins

This commit is contained in:
Ader Alisma 01 2024-09-05 19:37:50 -04:00
parent 3e0ddca9a4
commit 3ce5219946
3 changed files with 5 additions and 7 deletions

View File

@ -49,12 +49,12 @@ public class AllyUpgrade : MonoBehaviour, IPointerClickHandler
private void AssignUpgrades(Canvas canvas)
{
Debug.Log("Upgrade count: " + _instance.transform.childCount);
// Assign upgrade Prefabs
for (int i = 0; i < _instance.transform.childCount; i++)
{
GameObject upgradeEnfant = _instance.transform.GetChild(i).gameObject;
UpgradePlacementButton button = upgradeEnfant.GetComponent<UpgradePlacementButton>();
button.Initialize(_upgradeUnitCardList[i], _upgradePrefabList[i], gameObject, canvas);
Debug.Log("Button " + _upgradePrefabList[i].name);
}
}}

View File

@ -7,7 +7,6 @@ public class UnitTreeDisplay : MonoBehaviour, IPointerEnterHandler, IPointerExit
{
//private Vector3 _originPosition;
private Vector2 _size;
GameObject _gameObject;
private RectTransform _rectTransform;

View File

@ -23,7 +23,7 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler
private GameObject _prefab;
[SerializeField]
private GameObject _buttonContainer;
private GameObject _parentGameObject;
private GameObject _unitGameObject;
private Canvas _canvas;
@ -59,11 +59,10 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler
public void OnPointerClick(PointerEventData eventData)
{
//Change parent GameObject
Vector3 instantiatePosition = _parentGameObject.transform.position;
Vector3 instantiatePosition = _unitGameObject.transform.position;
Debug.Log("Upgrade clicked...");
Debug.Log("Position: " + instantiatePosition);
Instantiate(_prefab, instantiatePosition, Quaternion.identity, _canvas.transform);
Destroy(_parentGameObject);
Destroy(_unitGameObject);
Destroy(_buttonContainer);
}
@ -76,7 +75,7 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler
SetTextFor(_rockLabel, card.Rock);
_unitCardInformation = card;
_prefab = prefabGameObject;
_parentGameObject = parentGameObject;
_unitGameObject = parentGameObject;
_canvas = canvas;
}
}