Added high score

Also made player always render on top of enemies
This commit is contained in:
Pasha Bibko
2025-11-25 15:08:04 +00:00
parent 3ae3d3e0d0
commit 6ee784bf4e
6 changed files with 12 additions and 7 deletions

View File

@@ -1,9 +1,11 @@
using System;
using UnityEngine;
using UnityEngine.UI;
public class PlayerController : OrbitalPositionBehaviour
{
public static int PlayerScore = 0;
public static int s_PlayerScore;
private static int s_HighScore = 20;
private static PlayerController s_Instance;
public static bool IsPlayerAttached => s_Instance.m_OrbitalPosition.m_IsAttachedToRings;
@@ -28,7 +30,9 @@ public class PlayerController : OrbitalPositionBehaviour
public void Update()
{
m_ScoreText.text = PlayerScore.ToString();
m_ScoreText.text = s_PlayerScore.ToString();
if (s_PlayerScore > s_HighScore)
m_ScoreText.color = Color.yellow;
if (GlobalInput.IsScreenClicked() && GlobalOrbitalPositionManager.AllowPlayerInput)
{
@@ -60,7 +64,8 @@ public class PlayerController : OrbitalPositionBehaviour
m_Renderer.material.color = Color.green;
PlayerScore = 0;
s_HighScore = Math.Max(s_HighScore, s_PlayerScore);
s_PlayerScore = 0;
}
public override void OnReachCentre()