Esempio n. 1
0
    //"Wins" the scenario
    public void WinScenario()
    {
        //Prevent multiple successive calls to this method
        if (this.isScenarioOver == false)
        {
            endingText.gameObject.SetActive(true);
            endingText.text  = "Success!";
            endingText.color = Color.white;

            //Set the "scenario over" flag
            this.isScenarioOver = true;

            //Show the "scenario won" text
            //...

            //Delay before the level load, so the player can see the transition
            Timer.SetTimer(NarratorLibrary.PlayNarration(null, this.isFinal ? Narration.GameWin : NarratorLibrary.GetWinNarration()), this.gameObject, delegate()
            {
                //Load the next level
                Application.LoadLevel(Application.loadedLevel + 1);
            });
        }
    }
Esempio n. 2
0
    //"Loses" the scenario
    public void LoseScenario(Weapons loserWeapon)
    {
        //Prevent multiple successive calls to this method
        if (this.isScenarioOver == false)
        {
            endingText.gameObject.SetActive(true);
            endingText.text  = "Failure!";
            endingText.color = Color.white;

            //Set the "scenario over" flag
            this.isScenarioOver = true;

            //Show the "scenario lost" text
            //...

            //Delay before the level load, so the player can see the transition
            Timer.SetTimer(NarratorLibrary.PlayNarration(null, NarratorLibrary.GetFailNarration(loserWeapon)), this.gameObject, delegate()
            {
                //Restart the level
                Application.LoadLevel(Application.loadedLevel);
            });
        }
    }
 public void PlayNarration()
 {
     NarratorLibrary.PlayNarration(this.audioSource, this.narration);
 }