private IEnumerator DoElevatorCameraRotate(CurrentElevatorWall currentWall, CurrentElevatorWall newWall, float duration, bool fromEdgework, bool toEdgework) { if (currentWall == CurrentElevatorWall.Dropped && newWall != CurrentElevatorWall.Dropped) { ToggleCamera(false); } float initialTime = Time.time; Vector3 currentWallPosition = fromEdgework ? _elevatorEdgeworkCameraPositions[(int)currentWall] : _elevatorCameraPositions[(int)currentWall]; Vector3 currentWallRotation = fromEdgework ? _elevatorEdgeworkCameraRotations[(int)currentWall] : _elevatorCameraRotations[(int)currentWall]; Vector3 newWallPosition = toEdgework ? _elevatorEdgeworkCameraPositions[(int)newWall] : _elevatorCameraPositions[(int)newWall]; Vector3 newWallRotation = toEdgework ? _elevatorEdgeworkCameraRotations[(int)newWall] : _elevatorCameraRotations[(int)newWall]; Transform camera = SecondaryCamera.transform; while (Time.time - initialTime < duration) { float lerp = (Time.time - initialTime) / duration; camera.localPosition = new Vector3(Mathf.SmoothStep(currentWallPosition.x, newWallPosition.x, lerp), Mathf.SmoothStep(currentWallPosition.y, newWallPosition.y, lerp), Mathf.SmoothStep(currentWallPosition.z, newWallPosition.z, lerp)); camera.localEulerAngles = new Vector3(Mathf.SmoothStep(currentWallRotation.x, newWallRotation.x, lerp), Mathf.SmoothStep(currentWallRotation.y, newWallRotation.y, lerp), Mathf.SmoothStep(currentWallRotation.z, newWallRotation.z, lerp)); yield return(null); } camera.localPosition = newWallPosition; camera.localEulerAngles = newWallRotation; if (newWall == CurrentElevatorWall.Dropped) { ToggleCamera(true); } }
public override IEnumerator BombCommanderBombEdgework(Bomb bomb, string edge) { yield return(false); edge = edge.ToLowerInvariant().Trim(); if (string.IsNullOrEmpty(edge)) { edge = "all edges"; } IEnumerator showEdgework = TwitchPlaysService.Instance.DropAllHoldables(); while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } CurrentElevatorWall currentWall = _currentWall == CurrentElevatorWall.Dropped ? CurrentElevatorWall.Back : _currentWall; if (edge.EqualsAny("all edges", "l", "left")) { showEdgework = DoElevatorCameraRotate(_currentWall, CurrentElevatorWall.Left, 1, false, true); _currentWall = CurrentElevatorWall.Left; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } yield return(new WaitForSeconds(3)); } if (edge.EqualsAny("all edges", "b", "back")) { showEdgework = DoElevatorCameraRotate(_currentWall, CurrentElevatorWall.Back, 1, edge == "all edges", true); _currentWall = CurrentElevatorWall.Back; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } yield return(new WaitForSeconds(3)); } if (edge.EqualsAny("all edges", "r", "right")) { showEdgework = DoElevatorCameraRotate(_currentWall, CurrentElevatorWall.Right, 1, edge == "all edges", true); _currentWall = CurrentElevatorWall.Right; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } yield return(new WaitForSeconds(3)); } showEdgework = DoElevatorCameraRotate(_currentWall, currentWall, 1, true, false); _currentWall = currentWall; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } }
public override IEnumerator BombCommanderBombEdgework(Bomb bomb, Match edgeworkMatch) { yield return(false); if (edgeworkMatch == null || !edgeworkMatch.Success) { yield break; } for (int i = 0; i < edgeworkMatch.Groups.Count; i++) { DebugHelper.Log($"edgeworkMatch.Groups[{i}].Value = {edgeworkMatch.Groups[i].Value}"); } string edge = edgeworkMatch.Groups[1].Value.ToLowerInvariant().Trim(); if (string.IsNullOrEmpty(edge)) { edge = "all edges"; } IEnumerator showEdgework = MiscellaneousMessageResponder.DropAllHoldables(); while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } CurrentElevatorWall currentWall = _currentWall == CurrentElevatorWall.Dropped ? CurrentElevatorWall.Back : _currentWall; if (edge.EqualsAny("all edges", "l", "left")) { showEdgework = DoElevatorCameraRotate(_currentWall, CurrentElevatorWall.Left, 1, false, true); _currentWall = CurrentElevatorWall.Left; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } yield return(new WaitForSeconds(3)); } if (edge.EqualsAny("all edges", "b", "back")) { showEdgework = DoElevatorCameraRotate(_currentWall, CurrentElevatorWall.Back, 1, edge == "all edges", true); _currentWall = CurrentElevatorWall.Back; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } yield return(new WaitForSeconds(3)); } if (edge.EqualsAny("all edges", "r", "right")) { showEdgework = DoElevatorCameraRotate(_currentWall, CurrentElevatorWall.Right, 1, edge == "all edges", true); _currentWall = CurrentElevatorWall.Right; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } yield return(new WaitForSeconds(3)); } showEdgework = DoElevatorCameraRotate(_currentWall, currentWall, 1, true, false); _currentWall = currentWall; while (showEdgework.MoveNext()) { yield return(showEdgework.Current); } }