protected IEnumerator coResizeLayout( tk2dUILayout layout, Vector3 min, Vector3 max, float time ) { Vector3 minFrom = layout.GetMinBounds(); Vector3 maxFrom = layout.GetMaxBounds(); for (float t = 0; t < time; t += tk2dUITime.deltaTime) { float nt = Mathf.SmoothStep(0, 1, Mathf.Clamp01( t / time )); Vector3 currMin = Vector3.Lerp( minFrom, min, nt ); Vector3 currMax = Vector3.Lerp( maxFrom, max, nt ); layout.SetBounds( currMin, currMax ); yield return 0; } layout.SetBounds( min, max ); }
protected IEnumerator coResizeLayout(tk2dUILayout layout, Vector3 min, Vector3 max, float time) { Vector3 minFrom = layout.GetMinBounds(); Vector3 maxFrom = layout.GetMaxBounds(); for (float t = 0; t < time; t += tk2dUITime.deltaTime) { float nt = Mathf.SmoothStep(0, 1, Mathf.Clamp01(t / time)); Vector3 currMin = Vector3.Lerp(minFrom, min, nt); Vector3 currMax = Vector3.Lerp(maxFrom, max, nt); layout.SetBounds(currMin, currMax); yield return(0); } layout.SetBounds(min, max); }
void LateUpdate() { _layout.SetBounds( new Vector3(tk2dCamera.Instance.ScreenExtents.xMin, tk2dCamera.Instance.ScreenExtents.yMin, 0), new Vector3(tk2dCamera.Instance.ScreenExtents.xMax, tk2dCamera.Instance.ScreenExtents.yMax, 0) ); }
public void coResizeLayout(tk2dUILayout screenLay) { Vector3 minFrom = _UICamera.ScreenToWorldPoint(new Vector3(0, 0, -3)); Vector3 maxFrom = _UICamera.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, -3)); screenLay.SetBounds(minFrom, maxFrom); ///layout.SetBounds( min, max ); }