Added high score
Also made player always render on top of enemies
This commit is contained in:
@@ -7,7 +7,7 @@ Material:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: RedMat
|
||||
m_Name: BlackMat
|
||||
m_Shader: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
@@ -80,7 +80,7 @@ Transform:
|
||||
m_GameObject: {fileID: 4804673878835712602}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -1}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
||||
@@ -14,7 +14,7 @@ public class EnemyController : OrbitalPositionBehaviour
|
||||
public override void OnReachCentre()
|
||||
{
|
||||
if (GlobalOrbitalPositionManager.IsSimulationRunning)
|
||||
PlayerController.PlayerScore++;
|
||||
PlayerController.s_PlayerScore++;
|
||||
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class GlobalOrbitalPositionManager : MonoBehaviour
|
||||
if (ring.transform.localScale.x < 0.5f)
|
||||
{
|
||||
if (IsSimulationRunning)
|
||||
PlayerController.PlayerScore++;
|
||||
PlayerController.s_PlayerScore++;
|
||||
|
||||
toRemove.Add(ring);
|
||||
}
|
||||
|
||||
@@ -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