Speed Effect

This commit is contained in:
GamerClassN7 2022-01-29 11:54:13 +01:00
parent e3ab4cc468
commit 3dcacafb8b
2 changed files with 16 additions and 4793 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,9 @@ public class UiController : MonoBehaviour
public GameObject player = null; public GameObject player = null;
private Vector3 startPosition; private Vector3 startPosition;
private Vector3 playerPosition; private Vector3 playerPosition;
public TextMeshProUGUI uiDistance; public TextMeshProUGUI uiDistance;
public float distance = 0.0f; public float distance = 0.0f;
private float oldDistance = 0.0f;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -23,6 +23,10 @@ public class UiController : MonoBehaviour
{ {
playerPosition = this.player.transform.position; playerPosition = this.player.transform.position;
distance = Vector3.Distance(this.startPosition, this.playerPosition); distance = Vector3.Distance(this.startPosition, this.playerPosition);
if (oldDistance < distance)
{
uiDistance.text = "Score : " + distance.ToString("0"); uiDistance.text = "Score : " + distance.ToString("0");
oldDistance = distance;
}
} }
} }