mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-22 02:14:30 -05:00
Merge branch 'MelbyFinalSprint'
This commit is contained in:
@@ -16,15 +16,32 @@ public class Dash : NetworkBehaviour {
|
||||
float dashSpeed = 12;
|
||||
|
||||
CharacterController characterController;
|
||||
PlayerMovement pMove;
|
||||
|
||||
void Start(){
|
||||
characterController = this.gameObject.GetComponent<CharacterController>();
|
||||
characterController = GetComponent<CharacterController>();
|
||||
pMove = GetComponent<PlayerMovement>();
|
||||
}
|
||||
|
||||
//UPDATE CHECK FOR MOVEMENT ONLY WHEN DASHING
|
||||
void FixedUpdate(){
|
||||
if (!IsLocalPlayer) { return; }
|
||||
if(pMove.pStats.HasDash){
|
||||
DashMovement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator startCoolDown(){
|
||||
Debug.Log("start corotine");
|
||||
isOnCoolDown = true;
|
||||
//driver.startUICooldown("Nitro");
|
||||
yield return new WaitForSeconds(dashItem.cooldownM);
|
||||
isOnCoolDown = false;
|
||||
Debug.Log("end corotine");
|
||||
}
|
||||
|
||||
private void DashMovement(){
|
||||
if (Input.GetKeyDown(KeyCode.E) && isOnCoolDown == false)
|
||||
{
|
||||
currentDashTime = 0;
|
||||
@@ -43,13 +60,4 @@ public class Dash : NetworkBehaviour {
|
||||
//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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,23 +33,24 @@ public class GrapplingHook : NetworkBehaviour
|
||||
void Update()
|
||||
{
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) //If grapple button is hit
|
||||
{
|
||||
if (!isGrappled) //If we are not grappling
|
||||
if(pStats.HasGrapple){
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) //If grapple button is hit
|
||||
{
|
||||
hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance
|
||||
if (hookPointIndex != -1) //If there is a hookpoint
|
||||
if (!isGrappled) //If we are not grappling
|
||||
{
|
||||
hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from
|
||||
ropeLength = Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) + 0.5f;
|
||||
isGrappled = true; //toggle grappling state
|
||||
hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance
|
||||
if (hookPointIndex != -1) //If there is a hookpoint
|
||||
{
|
||||
hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from
|
||||
ropeLength = Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) + 0.5f;
|
||||
isGrappled = true; //toggle grappling state
|
||||
}
|
||||
}
|
||||
else //Else we are grappling
|
||||
{
|
||||
//physics tear down?
|
||||
isGrappled = false; //toggle grappling state to release
|
||||
}
|
||||
}
|
||||
else //Else we are grappling
|
||||
{
|
||||
//physics tear down?
|
||||
isGrappled = false; //toggle grappling state to release
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user