using System; using System.Collections; using System.Collections.Generic; using Plugins.CxShine.UIUtil; using UnityEngine; public class StarComp : MonoBehaviour { public GameObject StarOnPrefab; public GameObject StarOffPrefab; private Transform _selfTr; private void Start() { if (_selfTr == null) _selfTr = gameObject.GetComponent(); setStar(3); } public void setStar(float value) { if (_selfTr == null) { _selfTr = gameObject.GetComponent(); } ContainerUtil.RemoveAllChild(this, _selfTr); for (int i = 0; i < 5; i++) { value -= 1; if (value >= 0) { Instantiate(StarOnPrefab, _selfTr, false); } else { Instantiate(StarOffPrefab, _selfTr, false); } } } }