SHARE
TWEET

Untitled

a guest Nov 19th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class Exit : MonoBehaviour
  7. {
  8.     private string completedLevelName;
  9.     private GameObject levelState;
  10.     public bool yourBool;
  11.  
  12.     // Start is called before the first frame update
  13.     void Start()
  14.     {
  15.         levelState = GameObject.Find("Level State");
  16.         completedLevelName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
  17.     }
  18.  
  19.     // Update is called once per frame
  20.     void Update()
  21.     {
  22.  
  23.     }
  24.  
  25.     void OnTriggerEnter2D(Collider2D trigger)
  26.     {
  27.         if (trigger.gameObject.tag == "Player")
  28.         {
  29.             levelState.GetComponent<LevelState>().completedLevel(completedLevelName);
  30.         }
  31.  
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top