Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // John Cordeiro
- // john@johncordeiro.com
- //
- // LevelManager.cs
- using UnityEngine;
- using System.Collections;
- public class LooseLevel : MonoBehaviour {
- private LevelManager levelManager; // levelManager decleration
- void Start () {
- setInitialReferences (); // Set up the references needed to run the script
- Debug.Log (levelManager.name); // Displays the name of the LevelManager Script in the console
- }
- void OnTriggerEnter2D(Collider2D col){
- print ("Ball has entered the trigger " + col.name); // Prints the string and appends the colliders name
- levelManager.LoadLevel ("Win"); // Loads the win scene using levelManager.LoadLevel
- }
- void setInitialReferences(){
- // Reference to the LevelManager Script using GameObject.find().GetComponent()
- levelManager = GameObject.Find ("LevelManager").GetComponent <LevelManager> ();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement