Hello to all, i’ve got a problem, i make a cooldown, but, whatever i make, it’s always = 0
The script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SlowMotion : MonoBehaviour {
public float currentBulletTimer = 0f;
public float bulletTimeAllowed = 1f;
public float bulletTimeCooldown = 15f;
void Start () {
}
// Update is called once per frame
void Update () {
{
if (Input.GetKeyDown(KeyCode.Mouse1) && (bulletTimeCooldown >= 0))
{
if (Time.timeScale == 1.0)
{
Time.timeScale = 0.3f / bulletTimeAllowed;
}
else
Time.timeScale = 1.0f;
}
if (Time.timeScale <= 0.9)
{
bulletTimeCooldown = 15;
currentBulletTimer += Time.deltaTime * bulletTimeAllowed;
}
if (currentBulletTimer >= 1)
{
currentBulletTimer = 0;
Time.timeScale = 1.0f;
}
if (bulletTimeCooldown < 0) ;
{
bulletTimeCooldown = 0;
}
if (bulletTimeCooldown > 0)
{
bulletTimeCooldown -= Time.deltaTime * bulletTimeAllowed;
}
}
}
}