Advertisement
shadowplaycoding

P024_GUIManagementScript

Aug 18th, 2017
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 KB | None | 0 0
  1. ?using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5.  
  6. public class GUIManagementScript : MonoBehaviour {
  7.  
  8.     public static GUIManagementScript GUIManagerInstance;
  9.  
  10.     public List<GameObject> namePlates;
  11.  
  12.     public GameObject planetPanel;
  13.     public GameObject starBasePanel;
  14.  
  15.     void OnEnable()
  16.     {
  17.         GUIManagerInstance = this;
  18.         namePlates = new List<GameObject>();
  19.     }
  20.  
  21.     // Use this for initialization
  22.     void Start () {
  23.        
  24.     }
  25.    
  26.     // Update is called once per frame
  27.     void Update () {
  28.  
  29.         if(namePlates.Count > 0)
  30.         {
  31.             if (CameraController.cameraController.zoomLevel < 0.4)
  32.             {
  33.                 for (int i = 0; i < namePlates.Count; i++)
  34.                 {
  35.                     namePlates[i].transform.LookAt(Camera.main.transform);
  36.                     float rotY = namePlates[i].transform.localEulerAngles.y + 180f;
  37.                     namePlates[i].transform.localEulerAngles = new Vector3(
  38.                         -namePlates[i].transform.localEulerAngles.x,
  39.                         rotY,
  40.                         -namePlates[i].transform.localEulerAngles.z);
  41.                 }
  42.             }
  43.         }
  44.  
  45.     }
  46.  
  47.     /*
  48.     Copyright Shadowplay Coding 2017 - see www.shadowplaycoding.com for licensing details
  49.     Removing this comment forfits any rights given to the user under licensing.
  50.     */
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement