mirror of
https://github.com/PashaBibko/The-Mobius-Line.git
synced 2026-04-03 17:39:03 +00:00
Improved Timer QOL
Made it start on the player first moving and show on the game HUD.
This commit is contained in:
@@ -36,6 +36,16 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
// Calculates the movement direction
|
||||
m_MoveDir = (m_Orientation.forward * m_Input.y) + (m_Orientation.right * m_Input.x);
|
||||
|
||||
if (m_MoveDir != Vector3.zero && m_StartTime == 0.0f)
|
||||
{
|
||||
m_StartTime = Time.time;
|
||||
}
|
||||
|
||||
if (m_StartTime != 0.0f)
|
||||
{
|
||||
m_TimeText.text = (Time.time - m_StartTime).ToString("0.00") + " s";
|
||||
}
|
||||
|
||||
//
|
||||
if (m_OnSlope)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
[SerializeField] Canvas m_DeadCanvas;
|
||||
[SerializeField] Canvas m_CompletedCanvas;
|
||||
[SerializeField] Text m_CompletedText;
|
||||
[SerializeField] Text m_TimeText;
|
||||
|
||||
[Header("Debug Settings")]
|
||||
[SerializeField] Text m_SpeedDisplay;
|
||||
@@ -93,7 +94,7 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
|
||||
bool m_IsDead = false;
|
||||
|
||||
float m_StartTime;
|
||||
float m_StartTime = 0.0f;
|
||||
|
||||
// Only instance of the player
|
||||
static PlayerMovement s_Instance;
|
||||
@@ -108,8 +109,6 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
m_StartTime = Time.time;
|
||||
|
||||
//
|
||||
m_CompletedCanvas.enabled = false;
|
||||
m_DeadCanvas.enabled = false;
|
||||
|
||||
Reference in New Issue
Block a user