modify scripts
This commit is contained in:
@ -36,6 +36,7 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
|
||||
private bool isActive;
|
||||
private bool isAnimating;
|
||||
|
||||
protected override bool ShouldShowRewarded() => isRewarded && resourseToHoldBoost.GetValue() == 0;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@ -70,6 +71,11 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
|
||||
priceObject.gameObject.SetActive(false);
|
||||
countText.text = resourseToHoldBoost.GetValue().ToString();
|
||||
}
|
||||
else if (ShouldShowRewarded())
|
||||
{
|
||||
countTextObject.gameObject.SetActive(false);
|
||||
priceObject.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
countTextObject.gameObject.SetActive(false);
|
||||
@ -96,6 +102,10 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
|
||||
{
|
||||
ActivateBoost();
|
||||
}
|
||||
else if (ShouldShowRewarded())
|
||||
{
|
||||
return;
|
||||
}
|
||||
// If not, consume from the regular resource
|
||||
else if (resourceManager.ConsumeWithEffects(resourceToPay, count))
|
||||
{
|
||||
@ -110,6 +120,13 @@ namespace WordsToolkit.Scripts.GUI.Buttons.Boosts
|
||||
UpdatePriceDisplay();
|
||||
}
|
||||
|
||||
protected override void ExecuteEvent()
|
||||
{
|
||||
if(isRewarded)
|
||||
resourseToHoldBoost.Add(1);
|
||||
base.ExecuteEvent();
|
||||
}
|
||||
|
||||
protected virtual void ActivateBoost(bool hideButtons = true)
|
||||
{
|
||||
isAnimating = true;
|
||||
|
||||
Reference in New Issue
Block a user