Inheritance: MonoBehaviour
Beispiel #1
0
    //GameObject retryButton;
    //GameObject menuButton;
    //GameObject spottedCue;
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1f;
        // spottedCue = GameObject.Find("SpottedIndicator");
        // spottedCue.SetActive(false);
        player       = GameObject.FindWithTag("Player");
        playerScript = player.GetComponent <PlayerControl> ();
        audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>();
        // set the initial position of the player
        initialPlayerPos = player.transform.position;

        //only store this if the player is on level 1, 2, or 3
        if (Application.loadedLevel >= 3 && Application.loadedLevel <= 5)
        {
            openCutscene = GameObject.Find("Cutscene").GetComponent <OpeningCutscene>();
        }
        //only store if final level
        else if (Application.loadedLevel == 6)
        {
            endCutscene = GameObject.Find("HallwayRoom1").GetComponent <FinalLevelCutscene>();
        }
        gameOverPanel = GameObject.Find("GameOverPanel");
        //retryButton = GameObject.Find("RetryButton");
        //menuButton = GameObject.Find("MenuButton");
        gameOverPanel.SetActive(false);
        overlay.SetActive(false);
        overlay_image = overlay.GetComponent <Image>();
        //play music clip #3 (intro music)

        /*
         * audioHandler.LoopMusic(false);
         * audioHandler.PlayMusic(3);
         */
        //start level music at certain time
        //StartCoroutine("levelMusic");
    }
    //GameObject retryButton;
    //GameObject menuButton;
    //GameObject spottedCue;
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1f;
        // spottedCue = GameObject.Find("SpottedIndicator");
        // spottedCue.SetActive(false);
        player = GameObject.FindWithTag("Player");
        playerScript = player.GetComponent<PlayerControl> ();
        audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>();
        // set the initial position of the player
        initialPlayerPos = player.transform.position;

        //only store this if the player is on level 1, 2, or 3
        if (Application.loadedLevel >= 3 && Application.loadedLevel <= 5)
        {
            openCutscene = GameObject.Find("Cutscene").GetComponent<OpeningCutscene>();
        }
        //only store if final level
        else if(Application.loadedLevel == 6)
        {
            endCutscene = GameObject.Find("HallwayRoom1").GetComponent<FinalLevelCutscene>();
        }
        gameOverPanel = GameObject.Find("GameOverPanel");
        //retryButton = GameObject.Find("RetryButton");
        //menuButton = GameObject.Find("MenuButton");
        gameOverPanel.SetActive(false);
        overlay.SetActive(false);
        overlay_image = overlay.GetComponent<Image>();
        //play music clip #3 (intro music)
        /*
        audioHandler.LoopMusic(false);
        audioHandler.PlayMusic(3);
        */
        //start level music at certain time
        //StartCoroutine("levelMusic");
    }