Advertisement
Guest User

Untitled

a guest
Nov 30th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class EndLevel : MonoBehaviour           // gameOverText, instructionsText, runnerText, retryText, levelCompleteText, goForwardText;
  5. {
  6.     public GUIText gameOver, runner, instructions, retry;  
  7.     public GameObject gameOver_go, runner_go, instructions_go, retry_go, poop, player;
  8.    
  9.     void Start()
  10.     {
  11.         gameOver_go = GameObject.Find("Game Over Text");
  12.         gameOver = gameOver_go.guiText;
  13.         instructions_go = GameObject.Find ("Instructions Text");
  14.         instructions = instructions_go.guiText;
  15.         runner_go = GameObject.Find ("Runner Text");
  16.         runner = runner_go.guiText;
  17.         retry_go = GameObject.Find ("Retry Text");
  18.         retry = retry_go.guiText;
  19.         poop = GameObject.Find ("poop");
  20.         player = GameObject.Find ("Player");
  21.  
  22.        
  23.         DontDestroyOnLoad(gameOver_go);
  24.         DontDestroyOnLoad(instructions_go);
  25.         DontDestroyOnLoad(runner_go);
  26.         DontDestroyOnLoad(retry_go);
  27.         DontDestroyOnLoad(poop);
  28.         DontDestroyOnLoad(player);
  29.     }
  30.    
  31.     void OnTriggerEnter()
  32.     {
  33.         // the following is only required if the objects are nested;
  34.         gameOver_go.transform.parent = null; // unparent to root of level
  35.         runner_go.transform.parent = null;
  36.         instructions_go.transform.parent = null;
  37.         retry_go.transform.parent = null;
  38.        
  39.         // change level
  40.         Application.LoadLevel("Level 2");
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement