mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-28 05:14:04 -05:00
adjusted anything that refered to playerMovement
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MoveRagdollState : MoveBaseState
|
||||
{
|
||||
float ragTime;
|
||||
Vector3 prevRot;
|
||||
bool beginRagTimer = false;
|
||||
|
||||
public override void EnterState(MoveStateManager mSM, MoveBaseState previousState){
|
||||
|
||||
ragTime = mSM.pStats.RecovTime;
|
||||
prevRot = mSM.transform.localEulerAngles;
|
||||
mSM.capCol.enabled = true;
|
||||
mSM.moveController.enabled = false;
|
||||
mSM.rB.isKinematic = false;
|
||||
mSM.rB.detectCollisions = true;
|
||||
|
||||
mSM.rB.AddForce(mSM.dirHit, ForceMode.Impulse);
|
||||
}
|
||||
|
||||
public override void ExitState(MoveStateManager mSM, MoveBaseState nextState){
|
||||
mSM.pStats.GravVel = 50;
|
||||
mSM.capCol.enabled = false;
|
||||
mSM.moveController.enabled = true;
|
||||
mSM.rB.isKinematic = true;
|
||||
mSM.rB.detectCollisions = false;
|
||||
mSM.transform.localEulerAngles = prevRot;
|
||||
}
|
||||
|
||||
public override void UpdateState(MoveStateManager mSM){
|
||||
if(!beginRagTimer){
|
||||
beginRagTimer = Physics.Raycast(mSM.transform.position, -Vector3.up, mSM.distToGround + 1f);
|
||||
}
|
||||
else{
|
||||
ragTime -= Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(MoveStateManager mSM){
|
||||
//Has to be in Fixed Update because it has player movement
|
||||
if(ragTime <= 0 && beginRagTimer){
|
||||
ragTime = 0;
|
||||
beginRagTimer = false;
|
||||
|
||||
mSM.SwitchState(mSM.RecoveringState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7164475ffa0df6409ecd43b0517e4b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MoveRecoveringState : MoveBaseState
|
||||
{
|
||||
////// ADD SOMETHING THAT CHECKS ANIMATION FINISH BEFORE GO TO IDLE
|
||||
|
||||
public override void EnterState(MoveStateManager mSM, MoveBaseState previousState){
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
|
||||
public override void ExitState(MoveStateManager mSM, MoveBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(MoveStateManager mSM){
|
||||
mSM.SwitchState(mSM.IdleState);
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(MoveStateManager mSM){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dee57766c5fb3c34c8979d3e14d4e94e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user