mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 21:57:37 +02:00
Fork Lifter Spaghetti Code
This commit is contained in:
34
Assets/Scripts/GameProfiler.cs
Normal file
34
Assets/Scripts/GameProfiler.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameProfiler : MonoBehaviour
|
||||
{
|
||||
public float score = 0;
|
||||
public int totalHits = 0;
|
||||
|
||||
public bool perfect = false;
|
||||
|
||||
public static GameProfiler instance { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
perfect = true;
|
||||
}
|
||||
|
||||
public void IncreaseScore()
|
||||
{
|
||||
totalHits++;
|
||||
score = GetPercent(totalHits, GameManager.instance.allPlayerActions.Count);
|
||||
}
|
||||
|
||||
public float GetPercent(float value, float totalValue)
|
||||
{
|
||||
return (value / totalValue) * 100;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user