Coin Berry stuff
This commit is contained in:
@@ -19,6 +19,7 @@ public class GamePlayer : MonoBehaviour
|
||||
private BigInteger totalSpeedyBerries;
|
||||
private BigInteger totalCoinBerries;
|
||||
private BigInteger totalAttempts;
|
||||
private BigInteger totalCoins;
|
||||
private float boostLeft;
|
||||
private float slownessLeft;
|
||||
private float speedyLeft;
|
||||
@@ -27,6 +28,7 @@ public class GamePlayer : MonoBehaviour
|
||||
public TMP_Text scoreText;
|
||||
public TMP_Text highScoreText;
|
||||
public TMP_Text boostText;
|
||||
public TMP_Text coinText;
|
||||
public GameObject bird;
|
||||
public GameObject pausePanel;
|
||||
public Rigidbody2D rb;
|
||||
@@ -82,6 +84,7 @@ public class GamePlayer : MonoBehaviour
|
||||
totalSpeedyBerries = BazookaManager.Instance.GetGameStoreTotalSpeedyBerries();
|
||||
totalCoinBerries = BazookaManager.Instance.GetGameStoreTotalCoinBerries();
|
||||
totalAttempts = BazookaManager.Instance.GetGameStoreTotalAttepts();
|
||||
totalCoins = BazookaManager.Instance.GetCustomBirdIconData().Balance;
|
||||
|
||||
Cursor.visible = false;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
@@ -574,7 +577,11 @@ public class GamePlayer : MonoBehaviour
|
||||
}
|
||||
else if (UnityEngine.Vector3.Distance(bird.transform.position, coinBerry.transform.position) < 1.5f)
|
||||
{
|
||||
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/CoinCollect"), Camera.main.transform.position, 0.35f * BazookaManager.Instance.GetSettingSFXVolume());
|
||||
Destroy(coinBerry);
|
||||
totalCoinBerries++;
|
||||
totalCoins++;
|
||||
UpdateStats(0, 0);
|
||||
}
|
||||
if (speedyLeft > 0)
|
||||
{
|
||||
@@ -650,8 +657,12 @@ public class GamePlayer : MonoBehaviour
|
||||
BazookaManager.Instance.SetGameStoreTotalSpeedyBerries(totalSpeedyBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalCoinBerries(totalCoinBerries);
|
||||
BazookaManager.Instance.SetGameStoreTotalAttepts(totalAttempts);
|
||||
var customBirdIconData = BazookaManager.Instance.GetCustomBirdIconData();
|
||||
customBirdIconData.Balance = totalCoins;
|
||||
BazookaManager.Instance.SetCustomBirdIconData(customBirdIconData);
|
||||
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 (restartButton != null) restartButton.GetComponent<Renderer>().material.color = score == 0 ? Color.gray : Color.white;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ public class GamePlayerPauseMenu : MonoBehaviour
|
||||
public TMP_Text scoreText;
|
||||
public TMP_Text highScoreText;
|
||||
public TMP_Text boostText;
|
||||
public TMP_Text coinsText;
|
||||
public bool editingUI = false;
|
||||
|
||||
void Awake()
|
||||
@@ -47,10 +48,12 @@ public class GamePlayerPauseMenu : MonoBehaviour
|
||||
((RectTransform)scoreText.transform).anchoredPosition = new Vector2(0f, -70f);
|
||||
((RectTransform)highScoreText.transform).anchoredPosition = new Vector2(0f, -140f);
|
||||
((RectTransform)boostText.transform).anchoredPosition = new Vector2(0f, -190f);
|
||||
((RectTransform)coinsText.transform).anchoredPosition = new Vector2(260f, 47.5f);
|
||||
PlayerPrefs.DeleteKey("DraggedUIFPSText");
|
||||
PlayerPrefs.DeleteKey("DraggedUIScoreText");
|
||||
PlayerPrefs.DeleteKey("DraggedUIHighScoreText");
|
||||
PlayerPrefs.DeleteKey("DraggedUIBoostText");
|
||||
PlayerPrefs.DeleteKey("DraggedUICoinsText");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,5 +70,6 @@ public class GamePlayerPauseMenu : MonoBehaviour
|
||||
scoreText.GetComponent<DraggableUI>().canDrag = !scoreText.GetComponent<DraggableUI>().canDrag;
|
||||
highScoreText.GetComponent<DraggableUI>().canDrag = !highScoreText.GetComponent<DraggableUI>().canDrag;
|
||||
boostText.GetComponent<DraggableUI>().canDrag = !boostText.GetComponent<DraggableUI>().canDrag;
|
||||
coinsText.GetComponent<DraggableUI>().canDrag = !coinsText.GetComponent<DraggableUI>().canDrag;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user