mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
Merge branch 'FixGlideJump'
This commit is contained in:
@@ -24,11 +24,6 @@ public class AerialGroundedState : AerialBaseState
|
||||
else if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){
|
||||
aSM.SwitchState(aSM.JumpingState);
|
||||
}
|
||||
|
||||
//can grapple and in state that allows grapple
|
||||
else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){
|
||||
aSM.SwitchState(aSM.GrappleGroundedState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(AerialStateManager aSM){
|
||||
|
||||
@@ -24,7 +24,6 @@ public class AerialStateManager : NetworkBehaviour
|
||||
public AerialWallIdleState WallIdleState = new AerialWallIdleState();
|
||||
|
||||
//Grappling States
|
||||
public AerialGrappleGroundedState GrappleGroundedState = new AerialGrappleGroundedState();
|
||||
public AerialGrappleAirState GrappleAirState = new AerialGrappleAirState();
|
||||
////
|
||||
|
||||
@@ -49,6 +48,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 float coyJumpTimer = 0.1f; // Default Coyote Jump time
|
||||
public float curCoyJumpTimer = 0.1f; // current Coyote Jump time
|
||||
@@ -88,21 +88,14 @@ public class AerialStateManager : NetworkBehaviour
|
||||
Vector3 impact = Vector3.zero; // Impact Vector
|
||||
|
||||
//Grapple Variables
|
||||
public float maxGrabDistance = 50;// Max Distance can cast grapple
|
||||
float maxGrabDistance = 25;// Max Distance can cast grapple
|
||||
public GameObject hookPoint; // Actual Hook points
|
||||
public GameObject[] hookPoints; // Hook point list
|
||||
public int hookPointIndex; // Hook point Index
|
||||
public float distance; // distance of hookpoints
|
||||
public float maxGrappleDistance = 25; // Max Rope Length
|
||||
public float maxSwingSpeed = 50; // max swing speed
|
||||
public float minSwingSpeed = 20; // min swing speed
|
||||
public float swingAcc = 3f; // swing acceleration
|
||||
public float maxSwingMom = 60; // max swing momentum
|
||||
public bool release = false; // has player ungrappled
|
||||
public Vector3 tempRelease; // temporary release force vector
|
||||
public Vector3 lerpRelease; // lerped release force vector
|
||||
public Vector3 forceDirection; // force direction vector
|
||||
public bool eHeld; // is e being held
|
||||
public Vector3 postForceDirection; // force direction vector
|
||||
public float currentForcePower = 0;
|
||||
////
|
||||
|
||||
void Awake(){
|
||||
@@ -282,15 +275,7 @@ public class AerialStateManager : NetworkBehaviour
|
||||
//Actually applies the downwards movement
|
||||
void DownwardMovement(){
|
||||
Vector3 moveY = new Vector3(0,pStats.GravVel,0) * Time.deltaTime;
|
||||
|
||||
|
||||
|
||||
if(currentState == GrappleAirState){
|
||||
moveY = (new Vector3(0,pStats.GravVel,0) + forceDirection) * Time.deltaTime;
|
||||
}
|
||||
|
||||
moveController.Move(moveY);
|
||||
|
||||
moveController.Move(moveY);
|
||||
}
|
||||
|
||||
//applies Jump values and Variables
|
||||
@@ -327,7 +312,7 @@ public class AerialStateManager : NetworkBehaviour
|
||||
if(jumpHeld) curCoyJumpTimer = 0;
|
||||
|
||||
//If space/south face gamepad button isn't being pressed then jump is false
|
||||
if (Input.GetAxis("Jump") == 0){
|
||||
if (!Input.GetButton("Jump")){
|
||||
jumpHeld = false;
|
||||
}
|
||||
|
||||
@@ -503,16 +488,16 @@ public class AerialStateManager : NetworkBehaviour
|
||||
////
|
||||
|
||||
////Grapple Functions
|
||||
//Checks if the player can grapple
|
||||
public bool CheckGrapple(){
|
||||
if(!pStats.IsPaused){
|
||||
if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit
|
||||
{
|
||||
Debug.Log("Checking Hooks");
|
||||
hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance
|
||||
if (hookPointIndex != -1) //If there is a hookpoint
|
||||
{
|
||||
Debug.Log("Found Hook");
|
||||
hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from
|
||||
eHeld = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -539,9 +524,10 @@ public class AerialStateManager : NetworkBehaviour
|
||||
//lerped grapple release force and dissipation of it
|
||||
public void GrappleReleaseForce(){
|
||||
if(release){
|
||||
lerpRelease = Vector3.Lerp(lerpRelease, tempRelease, 9f * Time.deltaTime);
|
||||
tempRelease *= .98f;
|
||||
moveController.Move(lerpRelease);
|
||||
currentForcePower *= .90f;
|
||||
moveController.Move(postForceDirection * currentForcePower);
|
||||
|
||||
if(currentForcePower < .05) release = false;
|
||||
}
|
||||
}
|
||||
////
|
||||
|
||||
@@ -5,263 +5,94 @@ using UnityEngine;
|
||||
public class AerialGrappleAirState : AerialBaseState
|
||||
{
|
||||
|
||||
bool spaceHeld = true;
|
||||
float ropeLength; // current rope length
|
||||
float inclinationAngle; // inclination angle
|
||||
float theta = -1; // theta for rope angle
|
||||
Vector3 hookPointRight; // right vector of the hook point
|
||||
Vector3 curXZDir; // current straight line between player and hook point ignoring y axis
|
||||
Vector3 oldXZDir; // old straight line between player and hook point ignoring y axis
|
||||
Vector3 initialForceDirection;
|
||||
|
||||
Vector3 swingDirection; // Swing direction
|
||||
float swingSpeed = 10; // cur swing speed
|
||||
Vector3 tensionDirection; // tension direction
|
||||
float tensionForce; // tension force amplifier
|
||||
|
||||
float swingMom; // swing Mom amplifier
|
||||
float oldSwingMom; // old swing Momentum amplifier
|
||||
Vector3 momDirection; // momentum direction
|
||||
Vector3 tensionMomDirection; // tension momentum direction
|
||||
float distanceBeneathHook = -3f;
|
||||
float distanceAfterHook = 8f;
|
||||
Vector3 desiredPosition;
|
||||
|
||||
bool pointReached = false;
|
||||
|
||||
float initialForcePower = 4;
|
||||
|
||||
float defaultGraceTimer = 1.0f; // default timer
|
||||
float graceTimer; // grace period at the end of the swing so the player has time to let go
|
||||
bool swingGrace = true; // is the grace timer over
|
||||
|
||||
public override void EnterState(AerialStateManager aSM, AerialBaseState previousState){
|
||||
|
||||
|
||||
distanceBeneathHook = -3f;
|
||||
distanceAfterHook = 8f;
|
||||
pointReached = false;
|
||||
initialForcePower = 4;
|
||||
|
||||
//refresh jump number
|
||||
aSM.curJumpNum = 0;
|
||||
aSM.release = false;
|
||||
|
||||
Vector3 updatedYHookPoint = new Vector3(aSM.hookPoint.transform.position.x, aSM.hookPoint.transform.position.y - distanceBeneathHook, aSM.hookPoint.transform.position.z);
|
||||
Vector3 updatedXHookPointDirection = (new Vector3(aSM.transform.position.x, 0, aSM.transform.position.z) - new Vector3(aSM.hookPoint.transform.position.x, 0, aSM.hookPoint.transform.position.z)).normalized;
|
||||
|
||||
desiredPosition = updatedYHookPoint + (updatedXHookPointDirection * -distanceAfterHook);
|
||||
//rope length limit
|
||||
ropeLength = Vector3.Distance(aSM.transform.position, aSM.hookPoint.transform.position);
|
||||
if(ropeLength > aSM.maxGrappleDistance){
|
||||
ropeLength = aSM.maxGrappleDistance;
|
||||
}
|
||||
initialForceDirection = desiredPosition - aSM.transform.position;
|
||||
initialForceDirection = initialForceDirection.normalized;
|
||||
|
||||
//old and cur direction vector for player to hookpoint
|
||||
oldXZDir = (new Vector3(aSM.hookPoint.transform.position.x,0,aSM.hookPoint.transform.position.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized;
|
||||
curXZDir = (new Vector3(aSM.hookPoint.transform.position.x,0,aSM.hookPoint.transform.position.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized;
|
||||
aSM.postForceDirection = new Vector3(initialForceDirection.x, 0, initialForceDirection.z).normalized;
|
||||
aSM.currentForcePower = initialForcePower;
|
||||
|
||||
//swing momentum calculation
|
||||
swingMom = CalculateSwingMom(aSM.mSM.driftVel.magnitude * 50f, aSM);
|
||||
oldSwingMom = swingMom;
|
||||
|
||||
//Initialize variables
|
||||
aSM.pStats.GravVel = -1; // grav vel is adjusted so things work
|
||||
aSM.release = false; // player hasn't released
|
||||
aSM.lerpRelease = Vector3.zero; // reset lerp release
|
||||
spaceHeld = true;
|
||||
graceTimer = defaultGraceTimer; //sets grace timer
|
||||
}
|
||||
|
||||
public override void ExitState(AerialStateManager aSM, AerialBaseState nextState){
|
||||
|
||||
//If not going into grapple grounded state
|
||||
if(nextState != aSM.GrappleGroundedState){
|
||||
aSM.release = true;
|
||||
aSM.pStats.GravVel = 0;
|
||||
aSM.forceDirection = Vector3.zero;
|
||||
if(nextState == aSM.GroundedState || nextState == aSM.WallRunState){
|
||||
aSM.release = false;
|
||||
}
|
||||
|
||||
//If going into grapple grounded state
|
||||
else{
|
||||
aSM.pStats.GravVel = 0;
|
||||
aSM.forceDirection = Vector3.zero;
|
||||
aSM.release = true;
|
||||
aSM.pStats.GravVel = 10;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateState(AerialStateManager aSM){
|
||||
|
||||
//if pressing E or ragdolling then falling
|
||||
if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld && !aSM.pStats.IsPaused) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){
|
||||
aSM.SwitchState(aSM.FallingState);
|
||||
if(pointReached){
|
||||
//if grounded at when the point is reached then goto grounded state
|
||||
if(aSM.isGrounded){
|
||||
aSM.SwitchState(aSM.GroundedState);
|
||||
}
|
||||
else if(!aSM.isGrounded){
|
||||
aSM.SwitchState(aSM.FallingState);
|
||||
}
|
||||
//if wallrunning then wallrun
|
||||
else if(aSM.isWallRunning){
|
||||
aSM.SwitchState(aSM.WallRunState);
|
||||
}
|
||||
}
|
||||
else if((Input.GetKeyUp(KeyCode.E) || Input.GetKeyUp(KeyCode.JoystickButton2)) && aSM.eHeld){
|
||||
aSM.eHeld = false;
|
||||
}
|
||||
|
||||
//if pressing Jump then jump
|
||||
else if(Input.GetButton("Jump") && !spaceHeld && !aSM.pStats.IsPaused){
|
||||
aSM.SwitchState(aSM.JumpingState);
|
||||
}
|
||||
else if(!(Input.GetButton("Jump")) && spaceHeld){
|
||||
spaceHeld = false;
|
||||
}
|
||||
|
||||
//if grounded then grapple grounded
|
||||
else if(aSM.isGrounded){
|
||||
aSM.SwitchState(aSM.GrappleGroundedState);
|
||||
}
|
||||
|
||||
//if wallrunning then wallrun
|
||||
else if(aSM.isWallRunning){
|
||||
aSM.SwitchState(aSM.WallRunState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(AerialStateManager aSM){
|
||||
|
||||
////////ADD A LINE RENDERER WHEN WE GET THE HAND MODEL
|
||||
//Draw Line between player and hookpoint for debug purposes
|
||||
Debug.DrawRay(aSM.transform.position, (aSM.hookPoint.transform.position - aSM.transform.position)); //Visual of line
|
||||
Debug.DrawRay(aSM.transform.position, initialForceDirection); //Visual of line
|
||||
|
||||
//Calculate tether force direction based on hookpoint
|
||||
if (Vector3.Distance(aSM.transform.position, aSM.hookPoint.transform.position) >= ropeLength )
|
||||
{
|
||||
aSM.forceDirection = CalculateForceDirection(1, aSM.pStats.GravVel, aSM.hookPoint.transform.position, aSM) + RopeLengthOffset(aSM.hookPoint.transform.position, Vector3.Distance(aSM.transform.position, aSM.hookPoint.transform.position), aSM);
|
||||
Vector3 tempForceDir = desiredPosition - aSM.transform.position;
|
||||
tempForceDir = tempForceDir.normalized;
|
||||
tempForceDir = new Vector3(tempForceDir.x,0,tempForceDir.z).normalized;
|
||||
|
||||
if((aSM.postForceDirection - tempForceDir).magnitude >= .1f && !pointReached){
|
||||
pointReached = true;
|
||||
}
|
||||
else{
|
||||
aSM.forceDirection = Vector3.zero;
|
||||
}
|
||||
|
||||
//Move player based on their inputs
|
||||
aSM.moveController.Move(SwingMoveController(aSM));
|
||||
|
||||
//if Swing Momentum isn't zero then move player
|
||||
if(swingMom != 0){
|
||||
aSM.moveController.Move(CalculateMomentumDirection(aSM.pStats.GravVel, aSM.hookPoint.transform.position, aSM));
|
||||
swingMom -= .5f;
|
||||
}
|
||||
if(swingMom<0) swingMom = 0;
|
||||
|
||||
//Calculate temp release at every position
|
||||
aSM.tempRelease = CalculateSwingReleaseForce();
|
||||
|
||||
//Apply default gravity
|
||||
aSM.GravityCalculation(aSM.pStats.PlayerGrav);
|
||||
|
||||
}
|
||||
|
||||
//Calculate the tether direction vector and how much force that vector needs
|
||||
Vector3 CalculateForceDirection(float mass, float g, Vector3 hPoint, AerialStateManager aSM){
|
||||
|
||||
//tension direction and angle calculation
|
||||
tensionDirection = (hPoint - aSM.transform.position).normalized;
|
||||
inclinationAngle = Vector3.Angle((aSM.transform.position - hPoint).normalized, -aSM.transform.up);
|
||||
theta = Mathf.Deg2Rad * inclinationAngle;
|
||||
if(theta<=.1) theta = 0;
|
||||
|
||||
//How much force the tension needs
|
||||
tensionForce = mass * -g * Mathf.Cos(theta);
|
||||
|
||||
//force direction calculation based on tension direction and force
|
||||
Vector3 fDirection = tensionDirection * tensionForce;
|
||||
|
||||
//return force direction
|
||||
return fDirection;
|
||||
|
||||
}
|
||||
|
||||
Vector3 CalculateMomentumDirection(float g, Vector3 hPoint, AerialStateManager aSM){
|
||||
|
||||
tensionMomDirection = (hPoint - aSM.transform.position).normalized;
|
||||
hookPointRight = Vector3.Cross(oldXZDir, aSM.transform.up).normalized;
|
||||
momDirection = -1 * Vector3.Cross(hookPointRight, tensionMomDirection).normalized;
|
||||
|
||||
//if player is on the other side of hookpoint and swingMom is lower then update oldXZDir
|
||||
if(oldXZDir != curXZDir && swingMom <= (oldSwingMom*(.75f))){
|
||||
if(graceTimer >= 0){
|
||||
swingGrace = false;
|
||||
graceTimer -= .1f;
|
||||
}
|
||||
else{
|
||||
oldSwingMom = swingMom;
|
||||
oldXZDir = (new Vector3(aSM.hookPoint.transform.position.x,0,aSM.hookPoint.transform.position.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized;
|
||||
swingGrace = true;
|
||||
graceTimer = defaultGraceTimer;
|
||||
}
|
||||
|
||||
if(!pointReached){
|
||||
aSM.moveController.Move(initialForceDirection * initialForcePower);
|
||||
aSM.GravityCalculation(0);
|
||||
aSM.pStats.GravVel = 0;
|
||||
}
|
||||
else{
|
||||
//currentForcePower;
|
||||
aSM.GravityCalculation(aSM.pStats.PlayerGrav);
|
||||
}
|
||||
|
||||
//current line between hookpoint and player
|
||||
curXZDir = (new Vector3(hPoint.x,0,hPoint.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized;
|
||||
Debug.DrawRay(aSM.transform.position, momDirection * Time.deltaTime* 100, Color.green);
|
||||
|
||||
//return momentum dir * mom force
|
||||
return (momDirection * Time.deltaTime * swingMom);
|
||||
|
||||
}
|
||||
|
||||
//Calculates the players initial swing momentum using their height and their current velocity
|
||||
float CalculateSwingMom(float playerSpeed, AerialStateManager aSM){
|
||||
|
||||
//Calculate the players height compared to the lowest point in the swing
|
||||
float swingHeight = aSM.transform.position.y - (aSM.hookPoint.transform.position.y - ropeLength);
|
||||
if(swingHeight <= 1){
|
||||
swingHeight = 1;
|
||||
}
|
||||
|
||||
//calculates swing momentum based on height ands speed
|
||||
float sMom = playerSpeed + (swingHeight * 2.5f);
|
||||
if(sMom > aSM.maxSwingMom){
|
||||
sMom = aSM.maxSwingMom;
|
||||
}
|
||||
|
||||
//returns swing momentum
|
||||
return sMom;
|
||||
|
||||
}
|
||||
|
||||
//Special movement for the player while they swing
|
||||
Vector3 SwingMoveController(AerialStateManager aSM){
|
||||
|
||||
//WASD input
|
||||
float inputVert = Input.GetAxis("Vertical");
|
||||
float inputHor = Input.GetAxis("Horizontal");
|
||||
|
||||
//input is zero when nothing is pressed to prevent button easing values
|
||||
if((!Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S))) inputVert = 0;
|
||||
if((!Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D))) inputHor = 0;
|
||||
|
||||
//Swingspeed build up
|
||||
if((inputVert != 0 || inputHor != 0) && swingSpeed < aSM.maxSwingSpeed){
|
||||
swingSpeed += aSM.swingAcc;
|
||||
}
|
||||
else if((inputVert != 0 || inputHor != 0) && swingSpeed >= aSM.maxSwingSpeed){
|
||||
swingSpeed = aSM.maxSwingSpeed;
|
||||
}
|
||||
else if((inputVert == 0 && inputHor == 0)){
|
||||
swingSpeed = aSM.minSwingSpeed;
|
||||
}
|
||||
|
||||
//Swing direction based on player input
|
||||
swingDirection = Vector3.Cross(tensionDirection, ((aSM.transform.right * -inputVert) + (aSM.transform.forward * inputHor))).normalized;
|
||||
|
||||
//Swing movement with swing speed added
|
||||
Vector3 swingMovement = (swingDirection * Time.deltaTime * swingSpeed);
|
||||
|
||||
//returns swing movement vector
|
||||
return (swingMovement);
|
||||
|
||||
}
|
||||
|
||||
Vector3 RopeLengthOffset(Vector3 hPoint, float curDistance, AerialStateManager aSM){
|
||||
|
||||
//How powerful our offset movement has to be
|
||||
float offsetPower = ((curDistance - ropeLength) * 200f);
|
||||
|
||||
//The direction we need to apply force to offset when the rope gets lengthened beyond the necessary point
|
||||
Vector3 tenDirOffset = (hPoint - aSM.transform.position).normalized;
|
||||
|
||||
//returns rope offset direction * power
|
||||
return tenDirOffset * offsetPower * Time.deltaTime;
|
||||
|
||||
}
|
||||
|
||||
Vector3 CalculateSwingReleaseForce(){
|
||||
|
||||
//Swing release direction
|
||||
Vector3 releaseSwingForceDirection = momDirection * ((swingMom) + 10);
|
||||
releaseSwingForceDirection = new Vector3(releaseSwingForceDirection.x,0,releaseSwingForceDirection.z);
|
||||
|
||||
//if swingMom is low there is no release force
|
||||
if(swingMom < 2){
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
//return swing release direction
|
||||
return releaseSwingForceDirection * Time.deltaTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AerialGrappleGroundedState : AerialBaseState
|
||||
{
|
||||
public override void EnterState(AerialStateManager aSM, AerialBaseState previousState){
|
||||
|
||||
aSM.release = false; // release is false when grounded
|
||||
|
||||
}
|
||||
|
||||
public override void ExitState(AerialStateManager aSM, AerialBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(AerialStateManager aSM){
|
||||
|
||||
//if E is pressed or ragdolling then grounded
|
||||
if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld && !aSM.pStats.IsPaused) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){
|
||||
aSM.SwitchState(aSM.GroundedState);
|
||||
}
|
||||
else if((Input.GetKeyUp(KeyCode.E) || Input.GetKeyUp(KeyCode.JoystickButton2)) && aSM.eHeld){
|
||||
aSM.eHeld = false;
|
||||
}
|
||||
|
||||
//if not grounded and gravVel < 0 then grapple air
|
||||
else if(!aSM.isGrounded && aSM.pStats.GravVel < 0){
|
||||
aSM.SwitchState(aSM.GrappleAirState);
|
||||
}
|
||||
|
||||
//if distance between player and hookpoint is too far then grounded
|
||||
else if(Vector3.Distance(aSM.transform.position, aSM.hookPoint.transform.position) > aSM.maxGrappleDistance){
|
||||
aSM.SwitchState(aSM.GroundedState);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(AerialStateManager aSM){
|
||||
Debug.DrawRay(aSM.transform.position, (aSM.hookPoint.transform.position - aSM.transform.position)); //Visual of line
|
||||
|
||||
//Default gravity calculation
|
||||
aSM.GravityCalculation(aSM.pStats.PlayerGrav);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd53fea25f9a40e41812e6faae369b2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -22,7 +22,7 @@ public class MoveIdleState : MoveBaseState
|
||||
}
|
||||
|
||||
//If Q or joystick button1 crouch state
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState && mSM.aSM.currentState != mSM.aSM.GrappleGroundedState) && !mSM.pStats.IsPaused){
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
|
||||
mSM.SwitchState(mSM.CrouchState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MoveJogState : MoveBaseState
|
||||
}
|
||||
|
||||
//move to slide if Q or JoystickButton1
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState && mSM.aSM.currentState != mSM.aSM.GrappleGroundedState) && !mSM.pStats.IsPaused){
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
|
||||
mSM.SwitchState(mSM.SlideState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MoveRunState : MoveBaseState
|
||||
}
|
||||
|
||||
//move to slide if Q or JoystickButton1
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState && mSM.aSM.currentState != mSM.aSM.GrappleGroundedState) && !mSM.pStats.IsPaused){
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
|
||||
mSM.SwitchState(mSM.SlideState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MoveWalkState : MoveBaseState
|
||||
}
|
||||
|
||||
//move to slide if Q or JoystickButton1
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState && mSM.aSM.currentState != mSM.aSM.GrappleGroundedState) && !mSM.pStats.IsPaused){
|
||||
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
|
||||
mSM.SwitchState(mSM.SlideState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class OffenseAirKickState : OffenseBaseState
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
//if incapacitated then cooldown
|
||||
if((oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState || oSM.aSM.currentState == oSM.aSM.GrappleGroundedState)){
|
||||
if((oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class OffenseKickState : OffenseBaseState
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
//if incapacitated then cooldown
|
||||
if((oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState || oSM.aSM.currentState == oSM.aSM.GrappleGroundedState)){
|
||||
if((oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class OffenseCooldownState : OffenseBaseState
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
//if cooldown over and incapacitated then incapacitated
|
||||
if(cooldown && (oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState || oSM.aSM.currentState == oSM.aSM.GrappleGroundedState)){
|
||||
if(cooldown && (oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState)){
|
||||
oSM.SwitchState(oSM.IncapacitatedState);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class OffenseIncapacitatedState : OffenseBaseState
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
//if no longer incapacitated then None
|
||||
if((oSM.mSM.currentState != oSM.mSM.RagdollState && oSM.mSM.currentState != oSM.mSM.SlideState && oSM.mSM.currentState != oSM.mSM.CrouchState && oSM.mSM.currentState != oSM.mSM.CrouchWalkState) && (oSM.aSM.currentState != oSM.aSM.WallRunState && oSM.aSM.currentState != oSM.aSM.WallIdleState && oSM.aSM.currentState != oSM.aSM.GrappleAirState && oSM.aSM.currentState != oSM.aSM.GrappleGroundedState)){
|
||||
if((oSM.mSM.currentState != oSM.mSM.RagdollState && oSM.mSM.currentState != oSM.mSM.SlideState && oSM.mSM.currentState != oSM.mSM.CrouchState && oSM.mSM.currentState != oSM.mSM.CrouchWalkState) && (oSM.aSM.currentState != oSM.aSM.WallRunState && oSM.aSM.currentState != oSM.aSM.WallIdleState && oSM.aSM.currentState != oSM.aSM.GrappleAirState)){
|
||||
oSM.SwitchState(oSM.NoneState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class OffenseNoneState : OffenseBaseState
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
//if incapacitated then incapacitated
|
||||
if((oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState || oSM.aSM.currentState == oSM.aSM.GrappleGroundedState)){
|
||||
if((oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState)){
|
||||
oSM.SwitchState(oSM.IncapacitatedState);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user