using System.Collections; using System.Collections.Generic; using UnityEngine; public class PageSpot : MonoBehaviour { [SerializeField] GameObject mTplSpot; private Transform mCtn; private List mLightSpots; private void Awake() { mCtn = transform; } public void Init(int pTotalCount) { mLightSpots = new List(); for (int i = 0; i < pTotalCount; i++) { GameObject tSpot = Instantiate(mTplSpot, mCtn); tSpot.SetActive(true); tSpot.transform.localScale = Vector3.one; mLightSpots.Add(tSpot.transform.GetChild(0).gameObject); } } public void SetPageIndex(int pCurrentIndex) { for(int i = 0; i < mLightSpots.Count; i++) { mLightSpots[i].SetActive(pCurrentIndex == i); } } }