Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // John Cordeiro
  2. // john@johncordeiro.com
  3. //
  4. // LevelManager.cs
  5.  
  6. using UnityEngine;
  7. using System.Collections;
  8.  
  9. public class LooseLevel : MonoBehaviour {
  10.  
  11. private LevelManager levelManager; // levelManager decleration
  12.  
  13. void Start () {
  14.  
  15. setInitialReferences (); // Set up the references needed to run the script
  16. Debug.Log (levelManager.name); // Displays the name of the LevelManager Script in the console
  17.  
  18. }
  19.  
  20. void OnTriggerEnter2D(Collider2D col){
  21.  
  22. print ("Ball has entered the trigger " + col.name); // Prints the string and appends the colliders name
  23. levelManager.LoadLevel ("Win"); // Loads the win scene using levelManager.LoadLevel
  24.  
  25. }
  26.  
  27. void setInitialReferences(){
  28. // Reference to the LevelManager Script using GameObject.find().GetComponent()
  29. levelManager = GameObject.Find ("LevelManager").GetComponent <LevelManager> ();
  30.  
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement