mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-22 02:14:30 -05:00
Merge branch 'controller' into main
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class GrapplingHook : NetworkBehaviour
|
||||
{
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.E)) //If grapple button is hit
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) //If grapple button is hit
|
||||
{
|
||||
if (!isGrappled) //If we are not grappling
|
||||
{
|
||||
@@ -59,8 +59,8 @@ public class GrapplingHook : NetworkBehaviour
|
||||
if (isGrappled)
|
||||
{
|
||||
Debug.DrawRay(gameObject.transform.position, (hookPoint.transform.position - gameObject.transform.position)); //Visual of line
|
||||
|
||||
if (Input.GetKey(KeyCode.LeftShift)) //Extend hook
|
||||
|
||||
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.JoystickButton4)) //Extend hook
|
||||
{
|
||||
ropeLength += climbRate * Time.deltaTime;
|
||||
if (ropeLength > maxGrappleDistance)
|
||||
@@ -69,7 +69,7 @@ public class GrapplingHook : NetworkBehaviour
|
||||
}
|
||||
//Debug.Log(ropeLength.ToString());
|
||||
}
|
||||
if (Input.GetKey(KeyCode.RightShift)) // Retract Hook
|
||||
if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.JoystickButton5)) // Retract Hook
|
||||
{
|
||||
ropeLength -= climbRate * Time.deltaTime;
|
||||
if (ropeLength < 5)
|
||||
|
||||
Reference in New Issue
Block a user