/// <summary> /// This starts the tutorial /// </summary> public void StartTutorial() { //starting the 0 index of TutorialArray should start the process //(it will display the first tween hasTutorial = true; TutorialArray[0].SetActive(true); if (TutorialArray[0].GetComponent <resetTypewriter>() == null) { TutorialArray[0].AddComponent <resetTypewriter>(); } CurrentTypeWritter = TutorialArray[0].GetComponent <resetTypewriter>(); CurrentTypeWritter.Reset(TypewriterEffectTemplate); //if (secondTime) TutorialArray[0].GetComponentInChildren<TypewriterEffect>().ResetToBeginning(); if (TutorialExtra.Length > 0) { if (TutorialExtra[0] != null) { TutorialExtra[0].SetActive(true); } } TutoIndex += 1; SkipTutorialButton.SetActive(false); RepeatTutorialButton.SetActive(false); SetPressToContinue(); }
void NextHint() { if (!readyToClick) { return; } if (TutoIndex >= TutorialArray.Length) { if (secondTime && readyToClick) { FinishTutorial(); } readyToClick = true; return; } //we set Active the current box, and the tween will start animating TutorialArray[TutoIndex].SetActive(true); //Se resetea el TypewriterEffect if (TutorialArray[TutoIndex].GetComponent <resetTypewriter>() == null) { TutorialArray[TutoIndex].AddComponent <resetTypewriter>(); } CurrentTypeWritter = TutorialArray[TutoIndex].GetComponent <resetTypewriter>(); CurrentTypeWritter.Reset(TypewriterEffectTemplate); //we disable last box (if it exists) if (TutoIndex - 1 >= 0) { if (TutorialArray[TutoIndex - 1] != null) { TutorialArray[TutoIndex - 1].SetActive(false); TutorialArray[TutoIndex - 1].GetComponent <resetTypewriter>().DisableTypeWriter(); } } //After initial Text, player can Skip! SkipTutorialButton.SetActive(true); //we set active the "extra" game object (in case it exists) if (TutorialExtra.Length >= (TutoIndex + 1)) { if (TutorialExtra[TutoIndex] != null) { TutorialExtra[TutoIndex].SetActive(true); TutorialExtra[TutoIndex].BroadcastMessage("Freeze", SendMessageOptions.DontRequireReceiver); } } //For the next iteration (next click) TutoIndex += 1; //Set this to false, player will be "Stuck" until typegraphic tween finishes readyToClick = false; SetPressToContinue(); //This checks if all items of the array have been displayed in order to finish the tutorial if (!secondTime) { if (TutoIndex >= TutorialArray.Length) { FinishTutorial(); } } }