// vectorOperation.SmoothVectorLerp(transform.position,new Vector3(0,0,Random.Range(-10,10)),.5f,false,SetPosition ); public void ExponentialVectorLerp(Vector3 vector1, Vector3 vector2, float speed, bool isFixed, Action <Vector3> action) { if (isFixed) { coroutine.CoroutineFixed(t => { vector1 = Vector3.Lerp(vector1, vector2, t * speed); action?.Invoke(vector1); return(vector1 != vector2); }, null); } else { coroutine.CoroutineDeltaFrame(t => { vector1 = Vector3.Lerp(vector1, vector2, t * speed); action?.Invoke(vector1); return(vector1 != vector2); }, null); } }
private IEnumerator CoroutineTest() { _coroutine = _toolManager.GetTool <Coroutine>(); Debug.Log("Delta move started"); _coroutine.CoroutineDeltaFrame(e => e < 2, moveDelta); Debug.Log("Delta move end"); yield return(new WaitForSeconds(2)); Debug.Log("Fixed move started"); _coroutine.CoroutineFixed(e => e < 2, moveFixed); Debug.Log("Fixed move end"); yield return(new WaitForSeconds(2)); Debug.Log("Delta move started"); _coroutine.CoroutineWithWaitTime(2, moveDelta); Debug.Log("Delta move end"); yield return(new WaitForSeconds(2)); Debug.Log("Fixed move started"); _coroutine.CoroutineFixedWithWaitTime(2, moveFixed); Debug.Log("Fixed move end"); Debug.Log("wait and Delta move started"); _coroutine.CoroutineWaitSeconds(1, e => e < 2, moveDelta); Debug.Log("Delta move end"); Debug.Log("Coroutine test ended"); }