private void UpdateScoreDelta() { int remainCount = playerManager.scoreDeltaList.Count; foreach (ScoreDeltaInfo info in playerManager.scoreDeltaList) { remainCount--; if (remainCount < scoreDeltaMaxNum) { int index = 0; float maxActiveTime = 0; for (int i = 0; i < scoreDeltaMaxNum; ++i) { ScoreDeltaUI com = comScoreDelta[i]; if (com == null) { GameObject deltaObj = Instantiate(scoreDeltaObj); deltaObj.transform.parent = scoreDeltaUI.transform; comScoreDelta[i] = deltaObj.GetComponent <ScoreDeltaUI>(); index = i; break; } else if (!com.gameObject.activeSelf) { index = i; break; } else if (com.activeTime > maxActiveTime) { maxActiveTime = com.activeTime; index = i; } } ScoreDeltaUI tarCom = comScoreDelta[index]; tarCom.gameObject.SetActive(true); tarCom.SetScore(info.delta, info.full, scoreNumSprite); tarCom.transform.position = playerManager.GetPlayerTrans().position; } } playerManager.scoreDeltaList.Clear(); }