| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | using TMPro; |
| | | 5 | | |
| | | 6 | | public class Government : MonoBehaviour |
| | | 7 | | { |
| | | 8 | | // Start is called before the first frame update |
| | | 9 | | GameObject label; |
| | | 10 | | |
| | | 11 | | void Start() |
| | 3 | 12 | | { |
| | 3 | 13 | | GameObject player = GameObject.Find("Player"); |
| | 3 | 14 | | label = player.transform.GetChild(1).gameObject; |
| | 3 | 15 | | } |
| | | 16 | | |
| | | 17 | | // Update is called once per frame |
| | | 18 | | void Update() |
| | 7470 | 19 | | { |
| | | 20 | | |
| | 7470 | 21 | | } |
| | 3 | 22 | | public void showlabel(){ |
| | 3 | 23 | | label.GetComponent<TextMeshPro>().text = GetLabel().Substring(0, 20); |
| | 3 | 24 | | } |
| | | 25 | | |
| | 3 | 26 | | string GetLabel(){ |
| | 3 | 27 | | string ret = "Government:"; |
| | 4 | 28 | | if(gameObject.name == "Building8"){ |
| | 1 | 29 | | ret = ret + GetBuilding8Name(); |
| | 4 | 30 | | }else if(gameObject.name == "Building9"){ |
| | 1 | 31 | | ret = ret + GetBuilding9Name(); |
| | 3 | 32 | | }else if(gameObject.name == "Building91"){ |
| | 1 | 33 | | ret = ret + GetBuilding91Name(); |
| | 1 | 34 | | }else{ |
| | 0 | 35 | | ret = ret + "Unknown Department"; |
| | 0 | 36 | | } |
| | 3 | 37 | | return ret; |
| | 3 | 38 | | } |
| | | 39 | | |
| | 1 | 40 | | string GetBuilding8Name(){ |
| | 1 | 41 | | return "Town Hall"; |
| | 1 | 42 | | } |
| | | 43 | | |
| | 1 | 44 | | string GetBuilding9Name(){ |
| | 1 | 45 | | return "Police Department"; |
| | 1 | 46 | | } |
| | | 47 | | |
| | 1 | 48 | | string GetBuilding91Name(){ |
| | 1 | 49 | | return "Financial Department"; |
| | 1 | 50 | | } |
| | | 51 | | |
| | | 52 | | } |