всякое новое дерьмо, уже не важно

This commit is contained in:
2022-11-15 02:42:50 +05:00
parent b879fc63d9
commit 5c6dfa6557
73 changed files with 2246 additions and 182 deletions
+18 -2
View File
@@ -16,8 +16,9 @@ public class UITrainButton : MonoBehaviour, IPointerClickHandler
public bool isSelected { get; private set; }
LocomotionHandler locomotionHandler;
public bool ableToUse = true;
void Start()
void Awake()
{
buttonBase = GetComponent<Image>();
unselectedColor = buttonBase.color;
@@ -25,7 +26,7 @@ public class UITrainButton : MonoBehaviour, IPointerClickHandler
public void Select()
{
if(isSelected) return;
if(isSelected || !ableToUse) return;
if(locomotionHandler == null)
locomotionHandler = FindObjectOfType<LocomotionHandler>();
@@ -42,11 +43,26 @@ public class UITrainButton : MonoBehaviour, IPointerClickHandler
locomotionHandler.ShowTrain(trainType);
buttonBase.DOColor(selectedColor, .2f);
isSelected = true;
}
public void Reset()
{
isSelected = false;
ableToUse = true;
try
{
buttonBase.color = unselectedColor;
}
catch {}
}
public void Unselect()
{
if(!isSelected) return;
buttonBase.DOColor(Color.white, .2f);
isSelected = false;
}