public void PresentCoin(int coinNum, Vector3 origin, int startCoinNum, System.Action callback) { float popingDuration = 0.5f; float earnDuration = 0.75f; int showCoinNum = Mathf.RoundToInt(coinNum * 0.1f); showCoinNum = Mathf.Min(15, showCoinNum); var maxDelayFrame = 0; for (int i = 0; i < showCoinNum; i++) { maxDelayFrame = 2 * i; StartCoroutine(KKUtilities.DelayFrame(maxDelayFrame, () => StartCoroutine(EarnCoinAnimation(origin, popingDuration, earnDuration)))); } float delay = popingDuration + earnDuration - 0.25f; float duration = 0.08f * showCoinNum; StartCoroutine(KKUtilities.Delay(delay, () => { CountUpText(startCoinNum, startCoinNum + coinNum, duration); }, false)); this.DelayFrame(maxDelayFrame, () => { this.Delay(popingDuration + earnDuration, () => callback.SafeInvoke()); }); }