| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | using TMPro; |
| | | 5 | | |
| | | 6 | | public class Commercial : 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 = "Commercial:"; |
| | 4 | 28 | | if(gameObject.name == "Building6"){ |
| | 1 | 29 | | ret = ret + GetBuilding6Name(); |
| | 4 | 30 | | }else if(gameObject.name == "Building61"){ |
| | 1 | 31 | | ret = ret + GetBuilding61Name(); |
| | 3 | 32 | | }else if(gameObject.name == "Building7"){ |
| | 1 | 33 | | ret = ret + GetBuilding7Name(); |
| | 1 | 34 | | }else{ |
| | 0 | 35 | | ret = ret + "Unknown Commercial"; |
| | 0 | 36 | | } |
| | 3 | 37 | | return ret; |
| | 3 | 38 | | } |
| | | 39 | | |
| | 1 | 40 | | string GetBuilding6Name(){ |
| | 1 | 41 | | return "Pokemon Shopping Center"; |
| | 1 | 42 | | } |
| | | 43 | | |
| | 1 | 44 | | string GetBuilding61Name(){ |
| | 1 | 45 | | return "Kaiseki Restaurant"; |
| | 1 | 46 | | } |
| | | 47 | | |
| | 1 | 48 | | string GetBuilding7Name(){ |
| | 1 | 49 | | return "Totoro Theater"; |
| | 1 | 50 | | } |
| | | 51 | | |
| | | 52 | | } |