Show XP in game player scene
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -40,6 +41,7 @@ public class GamePlayer : MonoBehaviour
|
||||
[SerializeField] private SpriteRenderer overlayRender;
|
||||
private float lastMoveTime;
|
||||
[SerializeField] private GameObject berryParent;
|
||||
[SerializeField] private TMP_Text levelText;
|
||||
|
||||
[SerializeField] private GameObject mobileButtons;
|
||||
[SerializeField] private Button pauseButton;
|
||||
@@ -324,7 +326,7 @@ public class GamePlayer : MonoBehaviour
|
||||
{
|
||||
nextSpawnTime = Time.time + 1f / spawnRate;
|
||||
}
|
||||
float spawnProbability = Random.value;
|
||||
float spawnProbability = UnityEngine.Random.value;
|
||||
if (!pausePanel.activeSelf)
|
||||
{
|
||||
GameObject newBerry = new("Berry");
|
||||
@@ -375,7 +377,7 @@ public class GamePlayer : MonoBehaviour
|
||||
spriteRenderer.sortingOrder = -5;
|
||||
|
||||
float screenWidth = Camera.main.orthographicSize * 2 * Camera.main.aspect;
|
||||
float spawnPositionX = Random.Range(-screenWidth / 2.17f, screenWidth / 2.17f);
|
||||
float spawnPositionX = UnityEngine.Random.Range(-screenWidth / 2.17f, screenWidth / 2.17f);
|
||||
newBerry.transform.position = new UnityEngine.Vector3(spawnPositionX, Camera.main.orthographicSize + 1f, 0f);
|
||||
|
||||
Rigidbody2D rb = newBerry.AddComponent<Rigidbody2D>();
|
||||
@@ -561,7 +563,7 @@ public class GamePlayer : MonoBehaviour
|
||||
() => DoSpeedyBerry(randomBerry),
|
||||
() => DoAntiBerry(randomBerry)
|
||||
};
|
||||
funcs[Random.Range(0, funcs.Length)]();
|
||||
funcs[UnityEngine.Random.Range(0, funcs.Length)]();
|
||||
}
|
||||
if (speedyLeft > 0)
|
||||
{
|
||||
@@ -674,6 +676,8 @@ public class GamePlayer : MonoBehaviour
|
||||
if (Application.isMobilePlatform) restartButton.interactable = score != 0;
|
||||
if (DiscordRPCHandler.Instance != null)
|
||||
DiscordRPCHandler.Instance.UpdateRPC("Playing in normal mode", $"Score: {Tools.FormatWithCommas(score)} | High Score: {Tools.FormatWithCommas(highscore)}");
|
||||
var (_, level, currentXpInLevel, totalXpForLevel, percentDone) = Tools.GetLevelInfo();
|
||||
levelText.text = $"Level: {level}\nXP: {currentXpInLevel}/{totalXpForLevel} ({Math.Floor(percentDone)}%)";
|
||||
}
|
||||
|
||||
void CheckIfGrounded()
|
||||
|
||||
Reference in New Issue
Block a user