Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class EndLevel : MonoBehaviour // gameOverText, instructionsText, runnerText, retryText, levelCompleteText, goForwardText;
- {
- public GUIText gameOver, runner, instructions, retry;
- public GameObject gameOver_go, runner_go, instructions_go, retry_go, poop, player;
- void Start()
- {
- gameOver_go = GameObject.Find("Game Over Text");
- gameOver = gameOver_go.guiText;
- instructions_go = GameObject.Find ("Instructions Text");
- instructions = instructions_go.guiText;
- runner_go = GameObject.Find ("Runner Text");
- runner = runner_go.guiText;
- retry_go = GameObject.Find ("Retry Text");
- retry = retry_go.guiText;
- poop = GameObject.Find ("poop");
- player = GameObject.Find ("Player");
- DontDestroyOnLoad(gameOver_go);
- DontDestroyOnLoad(instructions_go);
- DontDestroyOnLoad(runner_go);
- DontDestroyOnLoad(retry_go);
- DontDestroyOnLoad(poop);
- DontDestroyOnLoad(player);
- }
- void OnTriggerEnter()
- {
- // the following is only required if the objects are nested;
- gameOver_go.transform.parent = null; // unparent to root of level
- runner_go.transform.parent = null;
- instructions_go.transform.parent = null;
- retry_go.transform.parent = null;
- // change level
- Application.LoadLevel("Level 2");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement