Added high score
Also made player always render on top of enemies
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user