In my Game i want to make it for every 25 points the timer goes down by 0.25 seconds. How cn i do this with these 2 sets of codes?
using UnityEngine;
using UnityEngine.UI;
public class KeepScoreManager : MonoBehaviour
{
public Text ScoreText;
private int score;
public Text NewBest;
public void IncreaseScore(int increment)
{
NewBest.text = PlayerPrefs.GetInt("NewBest").ToString();
score += increment;
if (score > PlayerPrefs.GetInt("NewBest"))
{
PlayerPrefs.SetInt("NewBest", score);
NewBest.text = PlayerPrefs.GetInt("NewBest").ToString();
}
ScoreText.text = score.ToString();
}
}
and the timer;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CountdownScript : MonoBehaviour
{
[SerializeField] private Text uiText;
[SerializeField] private float mainTimer;
[SerializeField] private GameObject panel;
void Start()
{
timer = mainTimer;
}
public float timer;
private bool canCount = true;
private bool doOnce = false;
void Update()
{
if (timer >= 0.0f && canCount)
{
timer -= Time.deltaTime;
uiText.text = timer.ToString("F");
}
else if (timer <= 0.0f && !doOnce)
{
canCount = false;
doOnce = true;
uiText.text = "0.00";
timer = 0.0f;
panel.SetActive(true);
}
}
public void ResetBtn()
{
timer = mainTimer;
canCount = true;
doOnce = false;
}
}