Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement