public IEnumerator ResourceAlert(Resource r, int num) { float time_start = 0.2F; float time_adding = 0.8F; float time_end_pause = 0.3F; float time_end = 0.2F; float time_total = time_start + time_adding + time_end; float time_curr = 0.0F; UIObj res = ResUI.Child[(int)r.Index]; UIAlert alert = Instantiate(UIResObj); alert.Init(-1, WorldObjects, time_total); WorldObjects.AddChild(alert); alert.ResetRect(); alert.transform.position = res.Txt[0].transform.position - res.Txt[0].transform.up * 0.5F; Tweens.Bounce(alert.transform); int init = r.Current; alert.Txt[0].text = "+" + num; alert.Svg[0].color = r.Col; yield return(new WaitForSeconds(time_start)); Tweens.Bounce(res.transform); /*float amt_soft = num / (time_adding/Time.deltaTime); * while((time_curr += Time.deltaTime) <= time_adding) * { * init += (int) amt_soft; * * res.Txt[0].text = r.ToString(); * * yield return null; * }*/ r.Add(num); res.Txt[0].text = r.ToString(); yield return(new WaitForSeconds(time_end_pause)); if (alert != null) { alert.PoolDestroy(); } yield return(new WaitForSeconds(time_end)); yield return(null); }