public IEnumerator Scale(Transform thisTransform, Vector3 startScale, Vector3 endScale, float value, ScaleObject.ScaleType moveType) { float rate = (moveType == ScaleObject.ScaleType.Time) ? 1.0f / value : 1.0f / Vector3.Distance(startScale, endScale) * value; float t = 0.0f; while (t < 1.0) { t += Time.deltaTime * rate; thisTransform.localScale = Vector3.Lerp(startScale, endScale, Mathf.SmoothStep(0.0f, 1.0f, t)); Bounds bounds = ForgeImport.GameObjectBounds(thisTransform.gameObject); thisTransform.position += (_bounds.center - bounds.center); yield return(null); } }
public IEnumerator Scale(Transform thisTransform, float byThatMuch, float value, ScaleObject.ScaleType moveType) { _bounds = ForgeImport.GameObjectBounds(thisTransform.gameObject); yield return(Scale(thisTransform, thisTransform.localScale, thisTransform.localScale * byThatMuch, value, moveType)); }