//Gets the event that ends the tutorial in correspondce to the tutorail
 private TutorialCompleted GetEndEvent(BeginTutorial beginningEvent)
 {
     if (beginningEvent == OnBuyHintTutorialBegan)
     {
         return(OnBuyHintTutorialComplete);
     }
     else if (beginningEvent == OnBuyPowerUpUpgradeTutorialBegan)
     {
         return(OnBuyPowerUpUpgradeTutorialComplete);
     }
     else if (beginningEvent == OnCraftingModeTutorialBegan)
     {
         return(OnCraftingModeTutorialComplete);
     }
     else if (beginningEvent == OnElementsDraggedIntoGatheringTutorialBegan)
     {
         return(OnElementsDraggedIntoGatheringTutorialComplete);
     }
     else if (beginningEvent == OnTierSwitchingTutorialBegan)
     {
         return(OnTierSwitchingTutorialComplete);
     }
     else
     {
         return(null);
     }
 }
    /// <summary>
    /// Times the tutorial completion.
    /// </summary>
    /// <returns>The tutorial completion.</returns>
    /// <param name="tutorial">The tutorial that was completed.</param>
    private IEnumerator TimeTutorialCompletion(BeginTutorial tutorial, MainMenuController.Tutorial tutorialEnum)
    {
        float timeInTutorial = 0;

        while (!tutorialHasEnded)
        {
            timeInTutorial += Time.deltaTime;
            yield return(new WaitForFixedUpdate());
        }
#if DEBUG
        Debug.Log("This tutorial took " + timeInTutorial + " to complete");
#endif
        SetTutorialComplete(tutorialEnum);
        GetEndEvent(tutorial)(timeInTutorial);
    }
    /// <summary>
    /// Exectes the tutorial. And times how long it takes the user to complete
    /// </summary>
    /// <param name="tutorial">The tutorial that is being run.</param>
    public void ExecuteTutorial(BeginTutorial tutorial, MainMenuController.Tutorial tutorialEnum)
    {
        if (tutorial == null)
        {
            return;
        }
        else
        {
            tutorial();
        }

        //turns on the mask to cover the game
        ToggleMask(true);

        tutorialHasEnded = false;
        TutorialActive   = true;

        //sets the enum to track which tutorial the script is executing
        CurrentTutorial = tutorialEnum;

        StartCoroutine(TimeTutorialCompletion(tutorial, tutorialEnum));
    }
 /// <summary>
 /// Times the tutorial completion.
 /// </summary>
 /// <returns>The tutorial completion.</returns>
 /// <param name="tutorial">The tutorial that was completed.</param>
 private IEnumerator TimeTutorialCompletion(BeginTutorial tutorial, MainMenuController.Tutorial tutorialEnum)
 {
     float timeInTutorial = 0;
     while (!tutorialHasEnded) {
         timeInTutorial += Time.deltaTime;
         yield return new WaitForFixedUpdate();
     }
     #if DEBUG
     Debug.Log("This tutorial took " + timeInTutorial + " to complete");
     #endif
     SetTutorialComplete(tutorialEnum);
     GetEndEvent(tutorial)(timeInTutorial);
 }
 //Gets the event that ends the tutorial in correspondce to the tutorail
 private TutorialCompleted GetEndEvent(BeginTutorial beginningEvent)
 {
     if (beginningEvent == OnBuyHintTutorialBegan) {
         return OnBuyHintTutorialComplete;
     } else if (beginningEvent == OnBuyPowerUpUpgradeTutorialBegan) {
         return OnBuyPowerUpUpgradeTutorialComplete;
     } else if (beginningEvent == OnCraftingModeTutorialBegan) {
         return OnCraftingModeTutorialComplete;
     } else if (beginningEvent == OnElementsDraggedIntoGatheringTutorialBegan) {
         return OnElementsDraggedIntoGatheringTutorialComplete;
     } else if (beginningEvent == OnTierSwitchingTutorialBegan) {
         return OnTierSwitchingTutorialComplete;
     } else {
         return null;
     }
 }
    /// <summary>
    /// Exectes the tutorial. And times how long it takes the user to complete
    /// </summary>
    /// <param name="tutorial">The tutorial that is being run.</param>
    public void ExecuteTutorial(BeginTutorial tutorial, MainMenuController.Tutorial tutorialEnum)
    {
        if (tutorial == null) {
            return;
        } else {
            tutorial();
        }

        //turns on the mask to cover the game
        ToggleMask(true);

        tutorialHasEnded = false;
        TutorialActive = true;

        //sets the enum to track which tutorial the script is executing
        CurrentTutorial = tutorialEnum;

        StartCoroutine (TimeTutorialCompletion(tutorial, tutorialEnum));
    }