mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 02:00:54 -05:00
Everything is StateMachined just bugtesting
This commit is contained in:
parent
ccbcbab71f
commit
095fe0a9cb
|
|
@ -5244,7 +5244,6 @@ MonoBehaviour:
|
|||
recovTime: 3
|
||||
playerGrav: 200
|
||||
gravVel: 0
|
||||
hasBlink: 0
|
||||
hasGlider: 1
|
||||
hasGrapple: 1
|
||||
hasWallrun: 1
|
||||
|
|
@ -5270,6 +5269,8 @@ GameObject:
|
|||
- component: {fileID: 4061813754685703500}
|
||||
- component: {fileID: 4061813754685703499}
|
||||
- component: {fileID: 4061813754685703501}
|
||||
- component: {fileID: 4061813754685703502}
|
||||
- component: {fileID: 4061813754685703503}
|
||||
m_Layer: 0
|
||||
m_Name: T-Pose
|
||||
m_TagString: ArcherTarget
|
||||
|
|
@ -5364,6 +5365,42 @@ MonoBehaviour:
|
|||
pStats: {fileID: 0}
|
||||
mSM: {fileID: 0}
|
||||
dashItem: {fileID: 11400000, guid: 3156de54e455b4348b2a6e79383383b0, type: 2}
|
||||
--- !u!114 &4061813754685703502
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4061813754685703498}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f89839a9c7d0204ea00e910d9c5c5ee, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
moveController: {fileID: 0}
|
||||
pStats: {fileID: 0}
|
||||
mSM: {fileID: 0}
|
||||
nitroItem: {fileID: 11400000, guid: a1c26807795a7ac4f83567455ce978ce, type: 2}
|
||||
nitroVelBoost: 40
|
||||
nitroAccBoost: 0.4
|
||||
--- !u!114 &4061813754685703503
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4061813754685703498}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc5a1a9c85c29a744aa6ca7f1a8dbc60, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
leg: {fileID: 0}
|
||||
legHitbox: {fileID: 0}
|
||||
moveController: {fileID: 0}
|
||||
pStats: {fileID: 0}
|
||||
mSM: {fileID: 0}
|
||||
aSM: {fileID: 0}
|
||||
--- !u!4 &4090990814600649861
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class dKickController : NetworkBehaviour
|
|||
isKicking = true;
|
||||
isDiveKicking = true;
|
||||
leg.SetActive(true);
|
||||
legRotation = -90;
|
||||
}
|
||||
//otherwise do ground kick for .3 seconds
|
||||
else if ((Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0) && isKicking == false && pMove.isSliding==false){
|
||||
|
|
@ -70,7 +71,6 @@ public class dKickController : NetworkBehaviour
|
|||
isKicking = false;
|
||||
legRotation = 0;
|
||||
leg.transform.eulerAngles = new Vector3(legRotation, leg.transform.eulerAngles.y, leg.transform.eulerAngles.z);
|
||||
legHitbox.GetComponent<Collider>().isTrigger = false;
|
||||
leg.SetActive(false);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,41 @@ using UnityEngine;
|
|||
|
||||
public class OffenseAirKickState : OffenseBaseState
|
||||
{
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
private float legRotation = 0;
|
||||
bool kicked = false;
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
oSM.leg.SetActive(true);
|
||||
legRotation = -90;
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
kicked = false;
|
||||
|
||||
oSM.StartCoroutine(kicking(8f));
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
legRotation = 0;
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
oSM.leg.SetActive(false);
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
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)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
|
||||
if(kicked || (oSM.aSM.currentState == oSM.aSM.GroundedState)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
oSM.moveController.Move(new Vector3(0,.002f,0));
|
||||
}
|
||||
|
||||
private IEnumerator kicking(float waitTime){
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
kicked = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,41 @@ using UnityEngine;
|
|||
|
||||
public class OffenseAirPunchState : OffenseBaseState
|
||||
{
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
private float legRotation = 0;
|
||||
bool kicked = false;
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
oSM.leg.SetActive(true);
|
||||
legRotation = -90;
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
kicked = false;
|
||||
|
||||
oSM.StartCoroutine(kicking(8f));
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
legRotation = 0;
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
oSM.leg.SetActive(false);
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
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)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
|
||||
if(kicked || (oSM.aSM.currentState == oSM.aSM.GroundedState)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
oSM.moveController.Move(new Vector3(0,.002f,0));
|
||||
}
|
||||
|
||||
private IEnumerator kicking(float waitTime){
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
kicked = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,49 @@ using UnityEngine;
|
|||
|
||||
public class OffenseKickState : OffenseBaseState
|
||||
{
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
float legRotation = 0;
|
||||
bool kicked = false;
|
||||
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
Debug.Log("Kicking State");
|
||||
|
||||
oSM.leg.SetActive(true);
|
||||
kicked = false;
|
||||
|
||||
oSM.StartCoroutine(kicking(1f));
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
legRotation = 0;
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
oSM.leg.SetActive(false);
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
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)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
|
||||
if(kicked){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
if(legRotation > -90){
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
legRotation -= 20;
|
||||
}
|
||||
else{
|
||||
legRotation = -90;
|
||||
}
|
||||
oSM.moveController.Move(new Vector3(0,.002f,0));
|
||||
}
|
||||
|
||||
private IEnumerator kicking(float waitTime){
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
kicked = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,47 @@ using UnityEngine;
|
|||
|
||||
public class OffensePunchState : OffenseBaseState
|
||||
{
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
float legRotation = 0;
|
||||
bool kicked = false;
|
||||
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
oSM.leg.SetActive(true);
|
||||
kicked = false;
|
||||
|
||||
oSM.StartCoroutine(kicking(1f));
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
legRotation = 0;
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
oSM.leg.SetActive(false);
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
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)){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
|
||||
if(kicked){
|
||||
oSM.SwitchState(oSM.CooldownState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
if(legRotation > -90){
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z);
|
||||
legRotation -= 20;
|
||||
}
|
||||
else{
|
||||
legRotation = -90;
|
||||
}
|
||||
oSM.moveController.Move(new Vector3(0,.002f,0));
|
||||
}
|
||||
|
||||
private IEnumerator kicking(float waitTime){
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
kicked = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,33 @@ using UnityEngine;
|
|||
|
||||
public class OffenseCooldownState : OffenseBaseState
|
||||
{
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
bool cooldown = false;
|
||||
|
||||
}
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
cooldown = false;
|
||||
|
||||
oSM.StartCoroutine(kickCooldown());
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
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)){
|
||||
oSM.SwitchState(oSM.IncapacitatedState);
|
||||
}
|
||||
else if(cooldown){
|
||||
oSM.SwitchState(oSM.NoneState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator kickCooldown(){
|
||||
yield return new WaitForSeconds(.5f);
|
||||
cooldown = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ public class OffenseIncapacitatedState : OffenseBaseState
|
|||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
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)){
|
||||
oSM.SwitchState(oSM.NoneState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
|
|
|||
|
|
@ -14,6 +14,25 @@ public class OffenseNoneState : OffenseBaseState
|
|||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
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)){
|
||||
oSM.SwitchState(oSM.IncapacitatedState);
|
||||
}
|
||||
else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){
|
||||
if(oSM.pStats.KickPow > 300){
|
||||
oSM.SwitchState(oSM.PunchState);
|
||||
}
|
||||
else{
|
||||
oSM.SwitchState(oSM.KickState);
|
||||
}
|
||||
}
|
||||
else if((Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){
|
||||
if(oSM.pStats.KickPow > 300){
|
||||
oSM.SwitchState(oSM.AirPunchState);
|
||||
}
|
||||
else{
|
||||
oSM.SwitchState(oSM.AirKickState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ public class OffenseStateManager : MonoBehaviour
|
|||
|
||||
////Objects Sections
|
||||
GameObject parentObj; // Parent object
|
||||
public GameObject leg; // leg object
|
||||
public GameObject legHitbox; // leg hitbox
|
||||
////
|
||||
|
||||
////Components Section
|
||||
|
|
@ -34,6 +36,7 @@ public class OffenseStateManager : MonoBehaviour
|
|||
////Scripts Section
|
||||
public PlayerStats pStats; // Player Stats
|
||||
public MoveStateManager mSM;
|
||||
public AerialStateManager aSM;
|
||||
////
|
||||
|
||||
void Awake(){
|
||||
|
|
@ -43,13 +46,20 @@ public class OffenseStateManager : MonoBehaviour
|
|||
rB = GetComponent<Rigidbody>(); //set Rigid Body
|
||||
capCol = GetComponent<CapsuleCollider>(); // set Capsule Collider
|
||||
capCol.enabled = true;
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
animator = GetComponent<Animator>(); // set animator
|
||||
////
|
||||
|
||||
////Initialize Player Objects
|
||||
leg = transform.Find("Leg").gameObject; // Set Leg Object
|
||||
legHitbox = leg.transform.Find("LegHitbox").gameObject; // Set Leg Hitbox
|
||||
leg.SetActive(false);
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
////
|
||||
|
||||
////Initialize Scripts
|
||||
pStats = GetComponent<PlayerStats>(); // set PlayerStats
|
||||
mSM = GetComponent<MoveStateManager>(); // set move state manager
|
||||
aSM = GetComponent<AerialStateManager>();
|
||||
////
|
||||
}
|
||||
|
||||
|
|
@ -81,4 +91,21 @@ public class OffenseStateManager : MonoBehaviour
|
|||
currentState = state;
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
Collider myCollider = collision.contacts[0].thisCollider;
|
||||
if (collision.transform.CompareTag("kickable") && myCollider == legHitbox.GetComponent<Collider>()){
|
||||
if(collision.gameObject.GetComponent<Rigidbody>().isKinematic == true){
|
||||
collision.gameObject.GetComponent<Rigidbody>().isKinematic = false;
|
||||
}
|
||||
Vector3 direction = this.transform.forward;
|
||||
Debug.Log(direction);
|
||||
collision.rigidbody.AddForce(direction * pStats.KickPow, ForceMode.Impulse);
|
||||
}
|
||||
if (collision.transform.CompareTag("destroyable") && myCollider == legHitbox.GetComponent<Collider>()){
|
||||
collision.transform.gameObject.GetComponent<BreakableBlock>().damage(pStats.KickPow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user