mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-25 07:57:08 -05:00
bug fixes
This commit is contained in:
parent
16a02b2332
commit
f83d22eab8
|
|
@ -5820,7 +5820,7 @@ Camera:
|
|||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 158431
|
||||
m_Bits: 682719
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ MonoBehaviour:
|
|||
onValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
- m_Target: {fileID: 1619285600}
|
||||
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
|
||||
m_MethodName:
|
||||
m_Mode: 1
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,8 +4,14 @@ using UnityEngine;
|
|||
|
||||
public class AerialFallingState : AerialBaseState
|
||||
{
|
||||
bool shouldGlide;
|
||||
public override void EnterState(AerialStateManager aSM, AerialBaseState previousState){
|
||||
|
||||
if(previousState == aSM.JumpingState && aSM.jumpHeld){
|
||||
shouldGlide = true;
|
||||
}
|
||||
else{
|
||||
shouldGlide = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExitState(AerialStateManager aSM, AerialBaseState nextState){
|
||||
|
|
@ -15,14 +21,14 @@ public class AerialFallingState : AerialBaseState
|
|||
public override void UpdateState(AerialStateManager 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,6 +9,7 @@ public class AerialGlidingState : AerialBaseState
|
|||
|
||||
//Modify base traction
|
||||
aSM.pStats.CurTraction = 1.0f;
|
||||
aSM.pStats.GravVel = -1;
|
||||
}
|
||||
|
||||
public override void ExitState(AerialStateManager aSM, AerialBaseState nextState){
|
||||
|
|
@ -43,7 +44,7 @@ public class AerialGlidingState : AerialBaseState
|
|||
public override void FixedUpdateState(AerialStateManager aSM){
|
||||
|
||||
//modified gravity calculation to fall slower
|
||||
aSM.GravityCalculation(9);
|
||||
aSM.GravityCalculation(8);
|
||||
|
||||
//if grapple released apply release force
|
||||
if(aSM.pStats.HasGrapple){
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ public class AerialJumpingState : AerialBaseState
|
|||
aSM.SwitchState(aSM.GroundedState);
|
||||
}
|
||||
|
||||
//if is wall running and in a state that allows it wallrun
|
||||
else if(aSM.isWallRunning){
|
||||
//if is wallrunning ands is in a state that allows it wallrun
|
||||
else if(aSM.isWallRunning && (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.SwitchState(aSM.WallRunState);
|
||||
}
|
||||
|
||||
//if can grapple and in a state that allows it grapple
|
||||
else if(aSM.CheckGrapple()){
|
||||
//if grapple is possible and in state that allows it grapple air
|
||||
else if(aSM.CheckGrapple() && (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.SwitchState(aSM.GrappleAirState);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ public class AerialStateManager : NetworkBehaviour
|
|||
//Jump Variables
|
||||
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
|
||||
|
|
@ -106,7 +105,7 @@ public class AerialStateManager : 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
|
||||
|
|
@ -217,8 +216,6 @@ public class AerialStateManager : NetworkBehaviour
|
|||
rB.AddForce(new Vector3(0,pStats.GravVel,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void SwitchState(AerialBaseState state){
|
||||
|
|
@ -395,8 +392,8 @@ public class AerialStateManager : NetworkBehaviour
|
|||
|
||||
|
||||
curJumpNum++;
|
||||
jumpHeld = true;
|
||||
jumpPressed = true;
|
||||
jumpHeld = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -637,7 +634,7 @@ public class AerialStateManager : NetworkBehaviour
|
|||
public void GrappleReleaseForce(){
|
||||
if(release){
|
||||
currentForcePower *= .90f;
|
||||
moveController.Move(postForceDirection * currentForcePower);
|
||||
moveController.Move(postForceDirection * currentForcePower * Time.deltaTime);
|
||||
|
||||
if(currentForcePower < .05) release = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ public class MoveStateManager : 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
|
||||
|
|
@ -182,12 +184,45 @@ public class MoveStateManager : 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class MoveCrouchState : MoveBaseState
|
|||
public override void UpdateState(MoveStateManager mSM){
|
||||
|
||||
//If player isn't pressing either Q or the joystick button they stop crouching if nothing is above them
|
||||
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"]))){
|
||||
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKey(GameManager.GM.bindableActions["slideKey"]))){
|
||||
|
||||
if ((Physics.Raycast(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up, out slideRay, 2f, mSM.layerMask) == false)){
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class MoveCrouchWalkState : MoveBaseState
|
|||
}
|
||||
|
||||
public override void UpdateState(MoveStateManager mSM){
|
||||
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"]))){
|
||||
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKey(GameManager.GM.bindableActions["slideKey"]))){
|
||||
mSM.SwitchState(mSM.CrouchState);
|
||||
}
|
||||
else if((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f)){
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class MoveSlideState : MoveBaseState
|
|||
mSM.pStats.CurTraction += .004f;
|
||||
|
||||
//If player isn't pressing either Q or the joystick button they stop sliding if nothing is above them
|
||||
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"]))){
|
||||
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKey(GameManager.GM.bindableActions["slideKey"]))){
|
||||
if ((Physics.Raycast(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up, out slideRay, 2f, mSM.layerMask) == false)){
|
||||
|
||||
//Determine which state to go into based on player speed
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//for keyboard
|
||||
/* walkForward = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("walkForwardKey", "W"));
|
||||
|
|
|
|||
|
|
@ -6,34 +6,34 @@ EditorUserSettings:
|
|||
serializedVersion: 4
|
||||
m_ConfigSettings:
|
||||
RecentlyUsedScenePath-0:
|
||||
value: 22424703114646680e0b0227036c7c021313113e3f66333e243d04
|
||||
value: 22424703114646680e0b0227036c7c1f18030a25203b68252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-1:
|
||||
value: 22424703114646680e0b0227036c7c1f18030a25203b68252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-2:
|
||||
value: 22424703114646680e0b0227036c7c1f18030a25203b68252320092a
|
||||
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-3:
|
||||
value: 22424703114646680e0b0227036c7000021e17243f66333e243d04
|
||||
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-4:
|
||||
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-7:
|
||||
value: 22424703114646680e0b0227036c731f1415016439262f2434
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646680e0b0227036c6b19021b1d192f2d2835633c133af6f9
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-7:
|
||||
value: 22424703114646680e0b0227036c7000021e17243f66333e243d04
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-8:
|
||||
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
|
||||
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-9:
|
||||
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
||||
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user