my code have no error but ranking position is not working properly
how I change in my project. I want to make RPS in game.
my code have no error but ranking position is not working properly
how I change in my project. I want to make RPS in game.
public int currentCheckPoint, lapCount;
public float distance;
private Vector3 checkPoint;
public float counter;
public int rank;
public GameObject panelcar;
public GameObject losepanel;
void Start()
{
currentCheckPoint = 1;
StartCoroutine(LevelFail());
}
// Update is called once per frame
void Update()
{
CalculateDistance();
}
void CalculateDistance()
{
distance = Vector3.Distance(transform.position, checkPoint);
counter = lapCount * 1000 + currentCheckPoint * 100 + distance;
}
private void OnTriggerEnter(Collider other)
{
if(other.tag == "CheckPoint")
{
currentCheckPoint = other.GetComponent<CurrentCheckPoint>().currentCheckPointNumber;
checkPoint = GameObject.Find("CheckPoint" + currentCheckPoint).transform.position;
}
if(other.tag == "Finish")
{
if(gameObject.name == "Player")
{
panelcar.SetActive(true);
Time.timeScale = 0f;
AudioListener.volume = 0f;
}
if (gameObject.name == "Red Car" || gameObject.name == "Orrange Car" || gameObject.name == "yellow Car" || gameObject.name == "Blue Car" || gameObject.name == "Tursh Car")
{
losepanel.SetActive(true);
Time.timeScale = 0f;
AudioListener.volume = 0f;
}
}
}