Advertisement
Guest User

MenuScript

a guest
Aug 12th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.57 KB | None | 0 0
  1.  
  2. public class MenuScript : MonoBehaviour {
  3.  
  4.     [HideInInspector]
  5.     public Vector3 blueScale;
  6.     [HideInInspector]
  7.     public Vector3 orangeScale;
  8.     [HideInInspector]
  9.     public Vector3 yellowScale;
  10.     [HideInInspector]
  11.     public Vector3 purpleScale;
  12.     [HideInInspector]
  13.     public Vector3 greenScale;
  14.     [HideInInspector]
  15.     public Vector3 redScale;
  16.    
  17.    
  18.     public float blueEnergy;
  19.     public float greeEnergy;
  20.     public float orangeEnergy;
  21.     public float purpleEnergy;
  22.     public float redEnergy;
  23.     public float yellowEnergy;
  24.    
  25.    
  26.     [HideInInspector]
  27.     public Transform blue;
  28.     [HideInInspector]
  29.     public Transform green;
  30.     [HideInInspector]
  31.     public Transform orange;
  32.     [HideInInspector]
  33.     public Transform purple;
  34.     [HideInInspector]
  35.     public Transform red;
  36.     [HideInInspector]
  37.     public Transform yellow;
  38.    
  39.     public  GameObject _blue;
  40.     private GameObject _green;
  41.     private GameObject _orange;
  42.     private GameObject _purple;
  43.     private GameObject _red;
  44.     private GameObject _yellow;
  45.  
  46.     private GameObject _refBlue;
  47.     //EnemyHealthBar enemyHealthLeft;
  48.     void Start()
  49.     {
  50.         FindItemsObjects ();
  51.     }
  52.  
  53.     void OnGUI()
  54.     {
  55.         if(GUI.Button(new Rect(10,120,100,50), "New Level"))
  56.         {
  57.             DeleteItems();
  58.             CreateItems();
  59.             FindItemsObjects();
  60.  
  61.         }
  62.     }
  63.  
  64.     public Transform FindChild(  GameObject parent, string name)
  65.     {
  66.         if (parent.name == name)
  67.         {
  68.             Debug.Log("Parent's Name is same as you are searching for");
  69.             return null;
  70.         }
  71.  
  72.         Transform pTransform = parent.GetComponent<Transform> ();
  73.         foreach (Transform t in pTransform)
  74.         {
  75.             if (t.name == name)
  76.             {
  77.                 return t;
  78.             }
  79.         }
  80.         return null;
  81.     }
  82.  
  83.     public void FindItemsObjects()
  84.     {
  85.  
  86.         DontDestroyOnLoad (_blue);
  87.         //energyBarSprite = bluePrefab.GetComponent<SpriteRenderer> ();
  88.         _blue = GameObject.Find ("Item_bbg(Clone)");
  89.         Debug.Log ("/nBLUE TOOOOO" + _blue);
  90.         blue = FindChild ( _blue, "line");
  91.  
  92.  
  93.         _green = GameObject.Find ("Item_gbg(Clone)");
  94.         green = FindChild ( _green, "line");
  95.         Debug.Log ("/nBLUE TOOOOO" + _green);
  96.         _orange = GameObject.Find ("Item_obg(Clone)");
  97.         orange = FindChild ( _orange, "line");
  98.        
  99.         _purple = GameObject.Find ("Item_pbg(Clone)");
  100.         purple = FindChild ( _purple, "line");
  101.        
  102.         _red = GameObject.Find ("Item_rbg(Clone)");
  103.         red = FindChild ( _red, "line");
  104.        
  105.         _yellow = GameObject.Find ("Item_ybg(Clone)");
  106.         yellow = FindChild ( _yellow, "line");
  107.        
  108.         blueScale = blue.localScale;
  109.         Debug.Log (blueScale);
  110.         orangeScale = orange.localScale;
  111.         yellowScale = yellow.localScale;
  112.         purpleScale = purple.localScale;
  113.         greenScale = green.localScale;
  114.         redScale = red.localScale;
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement