TheKingsRace/Assets/Scripts/PlayerScripts/MovementAbilities/Nitro.cs
Evan Nydahl 97b727b3db -changed cooldown thing (only needed for dodge and boost). May want to
deprecate these
-slight edits to mountain path
2021-12-03 13:32:37 -06:00

39 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Nitro : MonoBehaviour
{
private PlayerStats playerStats;
private CoolDown driver;
private bool isOnCoolDown = false;
public SpecialItem nitroItem;
//this will need to be set from scritable object or something;
private float coolDown;
// Start is called before the first frame update
void Start(){
playerStats = GetComponent<PlayerStats>();
coolDown = 5.0f;
//retrieves
driver = FindObjectOfType<CoolDown>();
}
// Update is called once per frame
void Update(){
//once cooldowns are implemented, put this on one (a long one)
if (Input.GetKeyDown(KeyCode.LeftShift) && isOnCoolDown == false){
playerStats.CurVel = playerStats.MaxVel;
StartCoroutine(startCoolDown());
}
}
private IEnumerator startCoolDown(){
Debug.Log("start corotine");
isOnCoolDown = true;
//driver.startUICooldown("Nitro");
yield return new WaitForSeconds(nitroItem.cooldownM);
isOnCoolDown = false;
Debug.Log("end corotine");
}
}