weather wheel and weather adjustments

This commit is contained in:
Melbyj1125
2022-02-28 13:42:51 -06:00
parent 46dff8f663
commit 5b6b4a2cb9
12 changed files with 194 additions and 229 deletions

View File

@@ -5,16 +5,14 @@ using UnityEngine;
public class dMoveSlideState : dMoveBaseState
{
//Slide Variables
float originalTraction; // Traction before slide started
RaycastHit slideRay; // slide raycast
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
//Rotate player and adjust height and adjust traction
mSM.pStats.CurVel = 0;
originalTraction = mSM.pStats.Traction;
mSM.moveController.height *= .5f;
mSM.pStats.Traction = 0.01f;
mSM.pStats.CurTraction = 0.01f;
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y - mSM.moveController.height * .5f,0);
//mSM.moveController.Move(new Vector3(0,-0.1f,0));
}
@@ -25,7 +23,7 @@ public class dMoveSlideState : dMoveBaseState
if(nextState != mSM.CrouchState){
mSM.gameObject.transform.localEulerAngles = new Vector3(0, 0, 0);
mSM.pStats.CurVel = mSM.calculatedCurVel;
mSM.pStats.Traction = originalTraction;
mSM.pStats.CurTraction = mSM.pStats.Traction;
mSM.moveController.height *= 2.0f;
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y + mSM.moveController.height * .25f,0);
}

View File

@@ -116,6 +116,8 @@ public class dMoveStateManager : NetworkBehaviour
//if (!IsLocalPlayer) { return; }
Cursor.lockState = CursorLockMode.Locked; // Lock cursor on start if you are the local player
pStats.Traction = pStats.CurTraction;
pStats.CurAcc = pStats.Acc;
}
// Update is called once per frame
@@ -180,7 +182,7 @@ public class dMoveStateManager : NetworkBehaviour
// while the speed is below max speed slowly increase it
else if ((pStats.CurVel >= pStats.MinVel) && (pStats.CurVel < pStats.MaxVel))
{
pStats.CurVel += pStats.Acc;
pStats.CurVel += pStats.CurAcc;
return pStats.CurVel;
}
//If the players speed is above or equal to max speed set speed to max
@@ -222,7 +224,7 @@ public class dMoveStateManager : NetworkBehaviour
Debug.DrawRay(gameObject.transform.position + new Vector3(0,.4f,0) + (rayOffset/2), moveXZ.normalized * 1f, Color.red);
Debug.DrawRay(gameObject.transform.position + new Vector3(0,2.2f,0) + rayOffset, moveXZ.normalized * .2f, Color.red);
driftVel = Vector3.Lerp(driftVel, moveXZ, pStats.Traction * Time.deltaTime);
driftVel = Vector3.Lerp(driftVel, moveXZ, pStats.CurTraction * Time.deltaTime);
if(currentState == GrappleAirState){
driftVel = Vector3.zero;
}
@@ -241,7 +243,7 @@ public class dMoveStateManager : NetworkBehaviour
//player vector should be under the circumstances
vel = moveX + moveZ;
Vector3 moveXZ = new Vector3(vel.x, 0, vel.z);
driftVel = Vector3.Lerp(driftVel, moveXZ, pStats.Traction * Time.deltaTime);
driftVel = Vector3.Lerp(driftVel, moveXZ, pStats.CurTraction * Time.deltaTime);
//need to have move controller involved for correct movement
if(currentState == CrouchState){