всякое новое дерьмо, уже не важно
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user