Game/Assets/Scripts/PointsManager.cs
2021-01-16 18:29:12 +01:00

32 lines
701 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PointsManager : MonoBehaviour
{
static public int points;
private float secoundDelay = 1;
void Start()
{
points = 0;
this.gameObject.GetComponent<MeshRenderer>().sortingLayerName = "Points";
this.gameObject.GetComponent<TextMesh>().color = new Color(1f, 1f, 1f, 0.7f);
}
void Update()
{
this.gameObject.GetComponent<TextMesh>().text = points.ToString();
secoundDelay -= Time.deltaTime;
if(secoundDelay <= 0)
{
points +=1;
secoundDelay = 1;
}
if (points < 0)
{
points = 0;
}
}
}