IEnumerator ActivateAnimation(ItemFrameScript item) { yield return null; float time = 0; float totalTime = 0.4f; Vector3 startScale = item.transform.localScale; Vector3 endScale = startScale * 2f; while (time < totalTime && item.IsActive) { time += Time.deltaTime; yield return null; if(item) item.transform.localScale = Vector3.Lerp(startScale, endScale, time / totalTime); } if (item) { if (item.IsActive) { item.transform.localScale = endScale; } else { item.transform.localScale = startScale; } } }
IEnumerator ActiveNext(ItemFrameScript item) { yield return new WaitForEndOfFrame(); item.IsActive = true; }