Advertisement
tomicz

Untitled

Jun 15th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class DestroyerScript : MonoBehaviour {
  5.  
  6. private GameMaster gm;
  7. private SpawnScript sc;
  8. private float maxPlatforms = 100f;
  9.  
  10. void Start ()
  11. {
  12.  
  13. gm = GameObject.FindGameObjectWithTag ("GameMaster").GetComponent<GameMaster> ();
  14. sc = GameObject.FindGameObjectWithTag ("Spawner").GetComponent<SpawnScript> ();
  15.  
  16. }
  17.  
  18. void Update ()
  19. {
  20.  
  21.  
  22.  
  23. }
  24.  
  25.  
  26.  
  27. void OnTriggerEnter2D(Collider2D junk){
  28.  
  29. if (junk.tag == "Player") {
  30.  
  31. Application.LoadLevel (1);
  32.  
  33. Debug.Log ("Player collided");
  34. }
  35. if (junk.gameObject.transform.parent) {
  36. Destroy (junk.gameObject.transform.parent.gameObject);
  37.  
  38.  
  39.  
  40. } else {
  41.  
  42. Destroy (junk.gameObject);
  43. gm.percentageCounter = maxPlatforms / sc.obj.Length;
  44.  
  45. }
  46.  
  47.  
  48.  
  49. }
  50.  
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement