using System.Collections; using System.Collections.Generic; using DG.Tweening; using UnityEngine; using UnityEngine.UI; public class UIMainMenu : UICanvas { [SerializeField] private Text stationName; [SerializeField] UITrainButton[] trainButtons; public Image aboutTrainButton; public Train currentTrain { get; set; } Tween tween; public void ShowAboutTrainButton() { aboutTrainButton.gameObject.SetActive(true); aboutTrainButton.color = new Color(1, 1, 1, 0); tween = aboutTrainButton.DOFade(.7f, 10f); } void Update() { if(aboutTrainButton.gameObject.activeSelf && currentTrain != null) aboutTrainButton.rectTransform .position = Camera.main.WorldToScreenPoint(currentTrain.transform.position + Vector3.up * 1.5f); } public void UpdateLocationMenu(Location location) { ResetButtons(); switch(location) { case(Location.AprelevkaDepo): stationName.text = "Депо Апрелевка"; break; case(Location.BulevardSlavyanski): stationName.text = "станция Славянский бульвар"; break; case(Location.Pechatniki): stationName.text = "Станция Печатники"; break; case(Location.Sherbinka): stationName.text = "Станция Щербинка"; break; case(Location.Shukinskaya): stationName.text = "Станция Щукинская"; break; case(Location.Solnechaya): stationName.text = "Станция Солнечная"; break; } } public void AbleToUseTrainButtons(bool isAbleToUse) { Debug.Log("tut: " + isAbleToUse); foreach(var button in trainButtons) button.ableToUse = isAbleToUse; } public void ResetButtons() { foreach(var button in trainButtons) button.Reset(); aboutTrainButton.gameObject.SetActive(false); if(currentTrain == null) return; currentTrain.anim.Kill(); currentTrain = null; } }