mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
bug fixes
This commit is contained in:
@@ -4,8 +4,14 @@ using UnityEngine;
|
||||
|
||||
public class dAerialFallingState : dAerialBaseState
|
||||
{
|
||||
bool shouldGlide;
|
||||
public override void EnterState(dAerialStateManager aSM, dAerialBaseState previousState){
|
||||
|
||||
if(previousState == aSM.JumpingState && aSM.jumpHeld){
|
||||
shouldGlide = true;
|
||||
}
|
||||
else{
|
||||
shouldGlide = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){
|
||||
@@ -15,12 +21,15 @@ public class dAerialFallingState : dAerialBaseState
|
||||
public override void UpdateState(dAerialStateManager aSM){
|
||||
|
||||
//if Grav Vel > 0 then jumping
|
||||
if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){
|
||||
if((Input.GetButton("Jump") && aSM.jumpPressed) && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){
|
||||
Debug.Log("Going to Jump From Fall");
|
||||
aSM.SwitchState(aSM.JumpingState);
|
||||
|
||||
}
|
||||
|
||||
//if jump has been pressed and has glider and is in a state that allows it glide
|
||||
else if(Input.GetButton("Jump") && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){
|
||||
else if((Input.GetButton("Jump") && (shouldGlide || (aSM.curJumpNum == aSM.pStats.JumpNum))) && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){
|
||||
Debug.Log("Going to Glide From Fall");
|
||||
aSM.SwitchState(aSM.GlidingState);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public class dAerialGlidingState : dAerialBaseState
|
||||
|
||||
//Modify base traction
|
||||
aSM.pStats.CurTraction = 1.0f;
|
||||
|
||||
aSM.pStats.GravVel = -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
public int curJumpNum; // current Jumps Used
|
||||
public bool jumpHeld; // Jump is Held
|
||||
public bool canJump = true; // can the player jump
|
||||
bool jumpPressed; // Jamp was pressed
|
||||
public bool jumpPressed; // Jamp was pressed
|
||||
public float coyJumpTimer = 0.13f; // Default Coyote Jump time
|
||||
public float curCoyJumpTimer = 0.13f; // current Coyote Jump time
|
||||
public float lowJumpMultiplier; // Short jump multiplier
|
||||
@@ -100,7 +100,7 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
Vector3 impact = Vector3.zero; // Impact Vector
|
||||
|
||||
//Grapple Variables
|
||||
float maxGrabDistance = 30;// Max Distance can cast grapple
|
||||
float maxGrabDistance = 60;// Max Distance can cast grapple
|
||||
public GameObject hookPoint; // Actual Hook points
|
||||
public GameObject[] hookPoints; // Hook point list
|
||||
public int hookPointIndex; // Hook point Index
|
||||
@@ -190,8 +190,6 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
rB.AddForce(new Vector3(0,pStats.GravVel,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void SwitchState(dAerialBaseState state){
|
||||
|
||||
@@ -66,6 +66,8 @@ public class dMoveStateManager : NetworkBehaviour
|
||||
RaycastHit wallHitTop, wallHitBot, wallExitTop, wallExitBot; // Raycast for momentum loss on wall hit
|
||||
private Vector3 lastVel; // previous vel
|
||||
private bool firstWallHit = false; // hit the wall for the first time
|
||||
private float tempCurVel;
|
||||
private bool setTempVel = false;
|
||||
|
||||
//Camera Variables
|
||||
private Vector3 camRotation; // cameras camera rotation vector
|
||||
@@ -172,12 +174,45 @@ public class dMoveStateManager : NetworkBehaviour
|
||||
////Broad Functions
|
||||
//Player Speed Calculator
|
||||
public float PlayerSpeed(){
|
||||
//If nothing is pressed speed is 0
|
||||
if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) || pStats.IsPaused)
|
||||
//If nothing is pressed speed is 0 set a tempVel
|
||||
if (((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) && !setTempVel) || pStats.IsPaused)
|
||||
{
|
||||
if(pStats.CurVel > 0.0f){
|
||||
tempCurVel = pStats.CurVel;
|
||||
setTempVel = true;
|
||||
}
|
||||
|
||||
pStats.CurVel = 0.0f;
|
||||
return pStats.CurVel;
|
||||
}
|
||||
//
|
||||
else if((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) && setTempVel){
|
||||
|
||||
tempCurVel -= .35f;
|
||||
if(tempCurVel <= 0){
|
||||
setTempVel = false;
|
||||
tempCurVel = 0;
|
||||
}
|
||||
|
||||
pStats.CurVel = 0.0f;
|
||||
return pStats.CurVel;
|
||||
}
|
||||
else if(tempCurVel > 0){
|
||||
|
||||
if(tempCurVel < pStats.MinVel){
|
||||
|
||||
pStats.CurVel = pStats.MinVel;
|
||||
tempCurVel = 0;
|
||||
setTempVel = false;
|
||||
return pStats.MinVel;
|
||||
}
|
||||
|
||||
pStats.CurVel = tempCurVel;
|
||||
tempCurVel = 0;
|
||||
setTempVel = false;
|
||||
|
||||
return pStats.CurVel;
|
||||
}
|
||||
//If current speed is below min when pressed set to minimum speed
|
||||
else if (pStats.CurVel < pStats.MinVel || firstWallHit == true)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user