private IEnumerator DishFinalization(Transform movable, float t, UnityAction end = null) { yield return(StartCoroutine(Lerps.RotateLerp(movable, 180, t / 5.0f))); // todo: replace with animator yield return(StartCoroutine(Lerps.RotateLerp(movable, 360, t / 5.0f))); yield return(new WaitForSeconds(2 * t / 5.0f)); yield return(StartCoroutine(Lerps.MoveLerp(movable, Vector2.right * Constants.SCREEN_WORLD_WIDTH, t / 5.0f))); // todo end?.Invoke(); }
private void CheckOrderRelease(Vector2 mouseWorldPosition) { if (controlledOrderHolder != null) { controlledOrderHolder.coroutineAuthor.StopCoroutine(controlledOrderHolder.coroutine); controlledOrderHolder.coroutine = null; // If dish created correctly var order = controlledOrderHolder.order; if (DishManager.instance.CheckIfCorrect(order)) { OrderManager.instance.RemoveOrder(controlledOrderHolder); controlledOrderHolder = null; DishManager.instance.OnDishFin(order); return; } // If not controlledOrderHolder.coroutineAuthor = this; controlledOrderHolder.coroutine = StartCoroutine( Lerps.MoveLerp(controlledOrderHolder.order.transform, controlledOrderHolder.regularPos, 0.2f, Lerps.Normalizators.Squared) ); controlledOrderHolder = null; } }