Fixed indicator and CooldownUI

This commit is contained in:
Evan Nydahl
2022-01-31 14:07:23 -06:00
parent 72e33adcbe
commit 09ea1fe031
12 changed files with 480 additions and 427 deletions

View File

@@ -5,6 +5,7 @@ using UnityEngine;
public class dDash : NetworkBehaviour{
private CoolDown driver;
public Vector3 moveDirection;
public const float maxDashTime = 1.0f;
@@ -19,6 +20,7 @@ public class dDash : NetworkBehaviour{
dPlayerMovement pMove;
void Start(){
driver = GameObject.Find("Canvas").GetComponent<CoolDown>();
characterController = this.gameObject.GetComponent<CharacterController>();
pMove = GetComponent<dPlayerMovement>();
}
@@ -52,7 +54,7 @@ public class dDash : NetworkBehaviour{
private IEnumerator startCoolDown(){
Debug.Log("start corotine");
isOnCoolDown = true;
//driver.startUICooldown("Nitro");
driver.startUICooldown(dashItem.name);
yield return new WaitForSeconds(dashItem.cooldownM);
isOnCoolDown = false;
Debug.Log("end corotine");

View File

@@ -4,16 +4,17 @@ using UnityEngine;
public class dNitro : MonoBehaviour
{
private PlayerStats playerStats;
private CoolDown driver;
private PlayerStats playerStats;
public SpecialItem nitroItem;
private bool isOnCoolDown = false;
private bool isNitroing = false;
//this will need to be set from scritable object or something;
private float coolDown;
// Start is called before the first frame update
void Start()
{
driver = GameObject.Find("Canvas").GetComponent<CoolDown>();
playerStats = GetComponent<PlayerStats>();
}
@@ -37,8 +38,9 @@ public class dNitro : MonoBehaviour
private IEnumerator startCoolDown(){
Debug.Log("start corotine");
isOnCoolDown = true;
// driver.startUICooldown("Nitro");
yield return new WaitForSeconds(coolDown);
driver.startUICooldown("Nitro");
yield return new WaitForSeconds(nitroItem.cooldownM);
isOnCoolDown = false;
Debug.Log("end corotine");
}
}