//Quality of Life coroutine: Moves through positions in a queue, as provided. IEnumerator TweenPosQueue(Transform go, Queue <TweenToWaypoint> waypoints) { while (waypoints.Count != 0) { TweenToWaypoint waypoint = waypoints.Dequeue(); yield return(StartCoroutine(TweenToPosition(go, waypoint.destination, waypoint.duration, AnimationCurve.Linear(0, 0, 1, 1)))); } }
private IEnumerator MovePlayerToDescentPosition() { bBeingPutInDescentPos = true; Debug.Log("In coroutine"); receivesInput = false; Vector3 pos = currentLedgeMarker.GetLedgePosition().position; cameraController.LookAtTransform(currentLedgeMarker.GetLedgeLook().position, 0.8f); Queue <TweenToWaypoint> qt = new Queue <TweenToWaypoint>(); TweenToWaypoint t1 = new TweenToWaypoint(new Vector3(pos.x, transform.position.y, pos.z), 0.5f); TweenToWaypoint t2 = new TweenToWaypoint(pos, 0.5f); qt.Enqueue(t1); qt.Enqueue(t2); bIsClimbing = true; yield return(StartCoroutine(TweenPosQueue(transform, qt))); bIsClimbing = true; receivesInput = true; bBeingPutInDescentPos = false; }