public void Awake() { playerObject = GameObject.FindGameObjectWithTag("Player"); playerController = playerObject.GetComponent <PlayerController>(); playerStartPos = playerObject.transform.position; tutorialUI = this.GetComponent <TutorialUIScript>(); this.key_moveUp = playerController.key_moveUp; this.key_moveDown = playerController.key_moveDown; this.key_moveRight = playerController.key_moveRight; this.key_moveLeft = playerController.key_moveLeft; this.key_colorOne = playerController.key_colorOne; this.key_colorTwo = playerController.key_colorTwo; this.key_colorThree = playerController.key_colorThree; this.key_shoot = playerController.key_shoot; this.key_cancelColor = playerController.key_cancelColor; spawnPoint = GameObject.FindGameObjectWithTag("ObjectSpawner").transform; offScreenPoint = GameObject.FindGameObjectWithTag("Offscreen").transform; backgrounds = GameObject.FindGameObjectsWithTag("Background"); tutorialUI.ChangeActive(tutorialUI.moveSprites, false); topSpawn = new Vector2(spawnPoint.position.x, spawnPoint.position.y + spawnHeightDifference); bottomSpawn = new Vector2(spawnPoint.position.x, spawnPoint.position.y - spawnHeightDifference); StartCoroutine("EventMinusOne"); }
IEnumerator EventMinusOne() { tutorialUI.infoText.text = "Welcome to the tutorial!"; tutorialUI.ChangeActive(tutorialUI.infoText, true); tutorialUI.ChangeActive(tutorialUI.spacebarText, true); bool pressed = false; while (!pressed) { if (Input.GetKeyDown(key_shoot)) { pressed = true; } yield return(null); } tutorialUI.ChangeActive(tutorialUI.spacebarText, false); tutorialUI.ChangeActive(tutorialUI.infoText, false); StartRoutine(); }