using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class BarCanvas : MonoBehaviour { [SerializeField] private Image healthBar; [SerializeField] private Image manaBar; [SerializeField] private ShotUIView shotPrefab; [SerializeField] private GameObject grid; [SerializeField] private Image captureBar; [SerializeField] private GameObject captureBack; public Image HealthBar => healthBar; public Image ManaBar => manaBar; public ShotUIView ShotUIView => shotPrefab; public Image CaptureBar => captureBar; public GameObject CaptureBack => captureBack; public Stack SpawnShotUI(int count) { Stack stack = new Stack(); List shots = new List(); for (int i = 0; i < count; i++) { shots.Add(Instantiate(shotPrefab.gameObject, grid.transform)); } shots.Reverse(); shots.ForEach(shot => stack.Push(shot.GetComponent())); return stack; } }