Fix restart button not being gray

This commit is contained in:
2025-08-24 15:00:43 -07:00
parent c0e3105abb
commit 35e3ad3712
2 changed files with 16 additions and 16 deletions

View File

@@ -2289,11 +2289,11 @@ MonoBehaviour:
overlayRender: {fileID: 450099081}
berryParent: {fileID: 157908646}
mobileButtons: {fileID: 872476494}
pauseButton: {fileID: 1577031231}
restartButton: {fileID: 34767209}
jumpButton: {fileID: 293594132}
rightButton: {fileID: 1125207525}
leftButton: {fileID: 2069651271}
pauseButton: {fileID: 1577031227}
restartButton: {fileID: 34767206}
jumpButton: {fileID: 293594129}
rightButton: {fileID: 1125207522}
leftButton: {fileID: 2069651268}
--- !u!1 &527090675
GameObject:
m_ObjectHideFlags: 0

View File

@@ -42,11 +42,11 @@ public class GamePlayer : MonoBehaviour
public GameObject berryParent;
public GameObject mobileButtons;
public HoldableButton pauseButton;
public HoldableButton restartButton;
public HoldableButton jumpButton;
public HoldableButton rightButton;
public HoldableButton leftButton;
public Button pauseButton;
public Button restartButton;
public Button jumpButton;
public Button rightButton;
public Button leftButton;
void Start()
{
@@ -205,11 +205,11 @@ public class GamePlayer : MonoBehaviour
var pos = touches[i].screenPosition;
UnityEngine.Vector3 clickPosition = Camera.main.ScreenToWorldPoint(new UnityEngine.Vector3(pos.x, pos.y, 0f));
clickPosition.z = 0f;
if (leftButton.isPressed) doMoveLeft = true;
if (rightButton.isPressed) doMoveRight = true;
if (jumpButton.isPressed) doJump = true;
if (restartButton.isPressed) doRestart = true;
if (pauseButton.isPressed) doBack = true;
if (leftButton.GetComponent<HoldableButton>().isPressed) doMoveLeft = true;
if (rightButton.GetComponent<HoldableButton>().isPressed) doMoveRight = true;
if (jumpButton.GetComponent<HoldableButton>().isPressed) doJump = true;
if (restartButton.GetComponent<HoldableButton>().isPressed) doRestart = true;
if (pauseButton.GetComponent<HoldableButton>().isPressed) doBack = true;
}
}
if (doMoveLeft && !doMoveRight)
@@ -608,7 +608,7 @@ public class GamePlayer : MonoBehaviour
scoreText.text = $"Score: {Tools.FormatWithCommas(score)} \\u2022 Attempts: {Tools.FormatWithCommas(attempts)}";
highScoreText.text = $"High Score: {Tools.FormatWithCommas(highscore)} \\u2022 Total Attempts: {Tools.FormatWithCommas(totalAttempts)}";
coinText.text = $"Coins: {Tools.FormatWithCommas(totalCoins)}";
if (Application.isMobilePlatform) restartButton.transform.GetChild(0).GetComponent<TMP_Text>().material.color = score == 0 ? Color.gray : Color.white;
if (Application.isMobilePlatform) restartButton.interactable = score != 0;
}
void CheckIfGrounded()