private void Update() { if (growing) { controller.Grow(speed * Time.deltaTime); } else { controller.Shrink(speed * Time.deltaTime); if (transform.localScale.x <= 0f) { Destroy(gameObject); } } }
private void Update() { if (totalGrowLength < MaximumLength) { float growLength = speed * Time.deltaTime; totalGrowLength += growLength; controller.Grow(growLength); } if (stop) { controller.Shrink(speed * Time.deltaTime); if (transform.localScale.x <= 0f) { Destroy(gameObject); } } }