private void Start() { player = GameObject.Find("Player"); sentences = new Queue <string>(); actualPhase = tutorialPhase.dialogue1; //dialogue1 StartDialogue(dialogue1); }
void MoveToNextPhase() { if (TutorialPhase != tutorialPhase.Info) { TutorialPhase += 1; } switch (TutorialPhase) { case tutorialPhase.Movement: MovementObject.SetActive(true); ControlsObject.SetActive(true); BlocksObject.SetActive(false); InfoObject.SetActive(false); Debug.Log("Tutorial: Movement phase."); break; case tutorialPhase.Blocks: MovementObject.SetActive(false); ControlsObject.SetActive(false); BlocksObject.SetActive(true); InfoObject.SetActive(false); Debug.Log("Tutorial: Blocks phase."); break; case tutorialPhase.Info: MovementObject.SetActive(false); BlocksObject.SetActive(false); InfoObject.SetActive(true); Debug.Log("Tutorial: Info phase."); break; } }
public void TurnOffTutorial(bool wasSkipped) { tutorialComplete = true; TutorialPhase = tutorialPhase.Info; InfoObject.SetActive(false); ControlsObject.SetActive(false); BlocksObject.SetActive(false); MovementObject.SetActive(false); if (wasSkipped == false) { Debug.Log("Completed tutorial. Starting waves."); } if (wasSkipped == true) { Debug.Log("Skipped tutorial. Starting waves."); } TimescaleController.Instance.SwitchInitialSequence(); playerControllerScript_P1.StartCoroutines(); foreach (GameObject block in Blocks) { Destroy(block); } this.gameObject.SetActive(false); return; }
void Start() { // Set all objects to false. tutorialComplete = false; MovementObject.SetActive(false); ControlsObject.SetActive(false); BlocksObject.SetActive(false); InfoObject.SetActive(false); TutorialPhase = tutorialPhase.Movement; // Set to first tutorial sequence. //StartCoroutine (DeactivateMovementDelay ()); }
void Update() { if (TutorialPhase == tutorialPhase.Blocks) { if (Blocks[0] == null && Blocks[1] == null && Blocks[2] == null && Blocks[3] == null) { TurnOffPhaseTemp(); TutorialPhase = tutorialPhase.Info; } } }
public void NextStep() { print("prompt " + textRef.text); switch (currentState) { case tutorialPhase.cookingIntro: //clear privous state currentState = tutorialPhase.cookbacon_try; clip1.SetActive(false); clip2.SetActive(true); nextButton.SetActive(false); dimBGTall.SetActive(false); dimBGShort.SetActive(true); break; case tutorialPhase.cookbacon2: currentState = tutorialPhase.cookbacon_try1; nextButton.SetActive(true); clip3.SetActive(false); clip4.SetActive(true); break; case tutorialPhase.cookbacon1: currentState = tutorialPhase.cookbacon_try1; clip3.SetActive(false); clip2.SetActive(true); cookingSpotLeft.hasBacon = true; cookingSpotRight.hasBacon = true; cookingSpotLeft.currentState = CookingController.cookingStates.almost; cookingSpotRight.currentState = CookingController.cookingStates.almost; cookingSpotLeft.cookStartTime = Time.time; cookingSpotLeft.baconBuffer = true; cookingSpotLeft.newBaconTime = Time.time + cookingSpotLeft.newBaconBuffer; cookingSpotRight.cookStartTime = Time.time; cookingSpotRight.baconBuffer = true; cookingSpotRight.newBaconTime = Time.time + cookingSpotLeft.newBaconBuffer; nextButton.SetActive(false); dimBGFullscreen.SetActive(false); dimBGUpperThird.SetActive(true); break; case tutorialPhase.cookbacon3: currentState = tutorialPhase.cookbacon4; clip6.SetActive(false); clip7.SetActive(true); break; case tutorialPhase.cookbacon4: currentState = tutorialPhase.attackingIntro; clip7.SetActive(false); clip11.SetActive(true); clipAnimator = clip11.GetComponent<Animator>(); nextButton.SetActive(false); promptRect = prompt.GetComponent<RectTransform>(); promptRect.anchorMax = new Vector2(0.5f, 0f); promptRect.anchorMin = new Vector2(0.5f, 0f); promptRect.anchoredPosition = new Vector2(0f,-55f); dimBGFullscreen.SetActive(false); dimBGLowerThin.SetActive(true); break; case tutorialPhase.attackingIntro: currentState = tutorialPhase.attack1; clip11.SetActive(false); //dimBGTall.SetActive(false); //dimBGShort.SetActive(true); //sharkLeftSpawner.spawnLimit = 3; sharkLeftSpawner.GetReady(); //sharkRightSpawner.spawnLimit = 3; sharkRightSpawner.GetReady(); //birdLeftSpawner.spawnLimit = 3; birdLeftSpawner.GetReady(); //birdRightSpawner.spawnLimit = 3; birdRightSpawner.GetReady(); //SpawnerScript.ready = true; break; case tutorialPhase.attack1: currentState = tutorialPhase.attack2; dimBGShort.SetActive(false); dimBGMedium.SetActive(true); break; case tutorialPhase.attack2: currentState = tutorialPhase.attack3; dimBGUpperThird.SetActive(false); dimBGFullscreen.SetActive(true); clip10.SetActive(true); break; case tutorialPhase.attack3: currentState = tutorialPhase.attack4; clip10.SetActive(false); dimBGFullscreen.SetActive(false); dimBGUpperThin.SetActive(true); break; case tutorialPhase.attack4: currentState = tutorialPhase.health; dimBGLowerThird.SetActive(false); dimBGFullscreen.SetActive(true); break; case tutorialPhase.health: currentState = tutorialPhase.exiting; clip9.SetActive(false); dimBGMidThird.SetActive(false); dimBGFullscreen.SetActive(true); //load main game scene break; case tutorialPhase.exiting: Toolbox.Instance.gData.tutorial = true; Toolbox.Instance.SaveGameData(); Toolbox.Instance.ShowLoading(); Toolbox.Instance.sharkHitCount = 0; Toolbox.Instance.birdHitCount = 0; Canvas.SetActive(false); SceneManager.LoadScene("MainGame"); break; } }
public void CookBaconTry1() { textRef.text = "Tap the cooking spot to eat bacon to restore health"; if (baconCount > 0) { currentState = tutorialPhase.cookbacon3; clip5.SetActive(false); clip6.SetActive(true); clip2.SetActive(false); nextButton.SetActive(true); dimBGUpperThird.SetActive(false); dimBGFullscreen.SetActive(true); //dimBGTall.SetActive(true); cookingSpotLeft.currentState = CookingController.cookingStates.empty; cookingSpotRight.currentState = CookingController.cookingStates.empty; } }
public void CookBaconTry() { textRef.text = "Tap the cooking spots to start cooking bacon"; tapCount = cookingSpotLeft.baconCount + cookingSpotRight.baconCount; if (tapCount > 0) { currentState = tutorialPhase.cookbacon1; clip2.SetActive(false); nextButton.SetActive(true); clip3.SetActive(true); dimBGFullscreen.SetActive(true); dimBGUpperThird.SetActive(false); } }
public void Attack4() { textRef.text = "Tap the cat button"; if (CatCount > 0) { currentState = tutorialPhase.health; dimBGUpperThin.SetActive(false); dimBGMidThird.SetActive(true); clip9.SetActive(true); nextButton.SetActive(true); promptRect = prompt.GetComponent<RectTransform>(); promptRect.anchorMax = new Vector2(0.5f, 0.5f); promptRect.anchorMin = new Vector2(0.5f, 0.5f); promptRect.anchoredPosition = new Vector2(0f,0f); } }
public void Attack1() { switch (enemyCount) { case 0: textRef.text = "Hit 3 enemies"; break; case 1: textRef.text = "Hit 2 more"; break; case 2: textRef.text = "Hit 1 more"; break; } //textRef.text = "Tap an enemy to swing at it. Hit 3 enemies"; // wait for user to hit 3 enemies enemyCount = Toolbox.Instance.sharkHitCount + Toolbox.Instance.birdHitCount; if (enemyCount > 3) { currentState = tutorialPhase.attack2; //dimBGShort.SetActive(false); //dimBGMedium.SetActive(true); dimBGLowerThin.SetActive(false); dimBGUpperThird.SetActive(true); promptRect = prompt.GetComponent<RectTransform>(); promptRect.anchorMax = new Vector2(0.5f, 1f); promptRect.anchorMin = new Vector2(0.5f, 1f); promptRect.anchoredPosition = new Vector2(0f,-114f); nextButton.SetActive(true); } }
// Update is called once per frame void Update() { switch (actualPhase) { case tutorialPhase.dialogue1: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue2); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue2: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue3); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue3: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue4); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue4: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue5); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue5: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue6); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue6: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue7); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue7: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue8); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue8: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; StartDialogue(dialogue9); InstantiateEnemies1(); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue9: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.staticSingleEnemy: player.GetComponent <PlayerController>().canMove = true; if (enemiesCount < 1) { actualPhase++; StartDialogue(dialogue10); } break; case tutorialPhase.dialogue10: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue11); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue11: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? InstantiateEnemies2(); } else { DisplayNextSentence(); } } break; case tutorialPhase.staticEnemies: player.GetComponent <PlayerController>().canMove = true; timer += Time.deltaTime; if (enemiesCount == 0 || timer > 10) { enemiesCount = 0; foreach (GameObject enemy in aEnemies) { if (enemy != null) { enemy.GetComponent <Animator>().SetTrigger(Animator.StringToHash("Die")); } } timer = 0; if (timer2 < 0.25) { timer2 += Time.deltaTime; } else { switch (enemiesCount) { case 3: actualPhase = tutorialPhase.dialogue12; StartDialogue(dialogue12); break; case 1: case 2: actualPhase = tutorialPhase.dialogue15; StartDialogue(dialogue15); break; case 0: actualPhase = tutorialPhase.dialogue18; StartDialogue(dialogue18); break; default: break; } foreach (GameObject enemy in aEnemies) { Destroy(enemy.gameObject); } aEnemies = new GameObject[0]; } } break; case tutorialPhase.dialogue12: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue13); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue13: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue14); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue14: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase = tutorialPhase.dialogue21; // ¿Oscurecer chat? InstantiateMovingEnemy(); StartDialogue(dialogue21); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue15: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue16); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue16: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue17); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue17: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase = tutorialPhase.dialogue21; // ¿Oscurecer chat? InstantiateMovingEnemy(); StartDialogue(dialogue21); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue18: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue19); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue19: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue20); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue20: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? InstantiateMovingEnemy(); StartDialogue(dialogue21); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue21: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.movingEnemy: player.GetComponent <PlayerController>().canMove = true; if (enemiesCount < 1) { actualPhase++; StartDialogue(dialogue22); } break; case tutorialPhase.dialogue22: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue23); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue23: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue24); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue24: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue25); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue25: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartLevelLearning(); } else { DisplayNextSentence(); } } break; case tutorialPhase.levelLearning: player.GetComponent <PlayerController>().canMove = true; break; case tutorialPhase.dialogue26: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue27); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue27: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue28); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue28: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue29); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue29: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue30: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue31: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue32); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue32: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue33: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue34: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue35: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue36: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue37); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue37: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue38); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue38: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue39); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue39: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue40: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue41); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue41: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue42: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue43); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue43: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue44); } else { DisplayNextSentence(); } } break; case tutorialPhase.dialogue44: player.GetComponent <PlayerController>().canMove = false; if (InputManager.Instance.nextXat) { if (dialogueEnded) { dialogueEnded = false; actualPhase++; // ¿Oscurecer chat? StartDialogue(dialogue44); } else { //SceneManager.LoadScene("") } } break; default: break; } }