Skip to content

Instantly share code, notes, and snippets.

@drusepth
Created October 9, 2023 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drusepth/0257ae9d982396863876c16d38bc3b1a to your computer and use it in GitHub Desktop.
Save drusepth/0257ae9d982396863876c16d38bc3b1a to your computer and use it in GitHub Desktop.
void Start()
{
StartCoroutine(Script());
}
private void Update()
{
if (waitingForClick && (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)))
waitingForClick = false;
}
IEnumerator Script()
{
// Silent pan & zoom to computer
cameraController.TriggerPanAndZoom();
yield return new WaitForSeconds(Mathf.Max(cameraController.panDuration, cameraController.zoomDuration));
yield return new WaitForSeconds(1f);
// Tutorial/background story intro
tutorialContainer.SetActive(true);
foreach (Transform child in tutorialContainer.transform)
{
child.gameObject.SetActive(true);
yield return new WaitForSeconds(3f);
}
yield return new WaitForSeconds(2f);
// Wait for the user to click to the next section
waitingForClick = true;
clickToContinue.SetActive(true);
while (waitingForClick)
yield return null;
clickToContinue.SetActive(false);
// Hide tutorial and show how to play
tutorialContainer.SetActive(false);
howToPlayContainer.SetActive(true);
// Wait for the user to click to the next section
waitingForClick = true;
clickToContinue.SetActive(true);
while (waitingForClick)
yield return null;
clickToContinue.SetActive(false);
// Hide how to play and show how to win
howToPlayContainer.SetActive(false);
howToWinContainer.SetActive(true);
// Wait for the user to click to start the game
waitingForClick = true;
clickToContinue.SetActive(true);
while (waitingForClick)
yield return null;
clickToContinue.SetActive(false);
// Quickly zoom into the computer to transition into the main game scene
cameraController.startPoint = cameraController.transform.position;
cameraController.startCameraSize = cameraController.GetComponent<Camera>().orthographicSize;
cameraController.finishPoint = new Vector2(-10.82f, 1.23f);
cameraController.endCameraSize = 0.2f;
cameraController.zoomDuration = 1f;
cameraController.panDuration = 1f;
cameraController.TriggerPanAndZoom();
yield return new WaitForSeconds(1f);
SceneManager.LoadScene("Remote Desktop Viewer");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment