mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-23 02:44:36 -05:00
-changed cooldown thing (only needed for dodge and boost). May want to
deprecate these -slight edits to mountain path
This commit is contained in:
@@ -10,6 +10,8 @@ public class dDash : NetworkBehaviour{
|
||||
public const float maxDashTime = 1.0f;
|
||||
public float dashDistance = 10;
|
||||
public float dashStoppingSpeed = 0.1f;
|
||||
public SpecialItem dashItem;
|
||||
private bool isOnCoolDown = false;
|
||||
float currentDashTime = maxDashTime;
|
||||
float dashSpeed = 12;
|
||||
|
||||
@@ -23,9 +25,10 @@ public class dDash : NetworkBehaviour{
|
||||
void FixedUpdate(){
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
if(characterController.enabled == true){
|
||||
if (Input.GetKeyDown(KeyCode.E))
|
||||
if (Input.GetKeyDown(KeyCode.E) && isOnCoolDown == false)
|
||||
{
|
||||
currentDashTime = 0;
|
||||
currentDashTime = 0;
|
||||
StartCoroutine(startCoolDown());
|
||||
}
|
||||
if(currentDashTime < maxDashTime)
|
||||
{
|
||||
@@ -40,4 +43,13 @@ public class dDash : NetworkBehaviour{
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator startCoolDown(){
|
||||
Debug.Log("start corotine");
|
||||
isOnCoolDown = true;
|
||||
//driver.startUICooldown("Nitro");
|
||||
yield return new WaitForSeconds(dashItem.cooldownM);
|
||||
isOnCoolDown = false;
|
||||
Debug.Log("end corotine");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ public class Dash : NetworkBehaviour {
|
||||
public const float maxDashTime = 1.0f;
|
||||
public float dashDistance = 10;
|
||||
public float dashStoppingSpeed = 0.1f;
|
||||
public SpecialItem dashItem;
|
||||
private bool isOnCoolDown = false;
|
||||
float currentDashTime = maxDashTime;
|
||||
float dashSpeed = 12;
|
||||
|
||||
@@ -23,9 +25,10 @@ public class Dash : NetworkBehaviour {
|
||||
void FixedUpdate(){
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.E))
|
||||
if (Input.GetKeyDown(KeyCode.E) && isOnCoolDown == false)
|
||||
{
|
||||
currentDashTime = 0;
|
||||
currentDashTime = 0;
|
||||
StartCoroutine(startCoolDown());
|
||||
}
|
||||
if(currentDashTime < maxDashTime)
|
||||
{
|
||||
@@ -36,7 +39,17 @@ public class Dash : NetworkBehaviour {
|
||||
{
|
||||
moveDirection = Vector3.zero;
|
||||
}
|
||||
|
||||
characterController.Move(moveDirection * Time.deltaTime * dashSpeed);
|
||||
}
|
||||
|
||||
private IEnumerator startCoolDown(){
|
||||
Debug.Log("start corotine");
|
||||
isOnCoolDown = true;
|
||||
//driver.startUICooldown("Nitro");
|
||||
yield return new WaitForSeconds(dashItem.cooldownM);
|
||||
isOnCoolDown = false;
|
||||
Debug.Log("end corotine");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
|
||||
@@ -29,8 +30,9 @@ public class Nitro : 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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user