public void Die() { if (_dead) { return; } _dead = true; transform.localScale = Vector3.zero; _waterfallParticles.RequestAndPlayParticles(transform.position); Vector3 pos = transform.position; pos.y = 0.01f; // small offset for render var element = _poolElements.RequestObject(pos); if (element) { element.Value.transform.localScale = Vector3.zero; var scale = new CoroutineTransformScale(element.Value, Vector3.zero, Vector3.one) .SetDelay(.5f); StartCoroutine(scale.GetIEnumerator()); } }
public ColorFlow Expand(float x) { Vector3 to = Vector3.one; to.x = x; to.y = 10f; var anim = new CoroutineTransformScale(transform, Vector3.zero, to) .SetInterpolation(new EaseInterpolation(3f)) .SetDuration(1f); StartCoroutine(anim.GetIEnumerator()); return(this); }