diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index 85f2fbd..28829c2 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -2225,7 +2225,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1405946429} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 36.3, y: 24.5, z: 13.7} + m_LocalPosition: {x: 36.3, y: 22.3, z: 13.7} m_LocalScale: {x: 10, y: 10, z: 10} m_Children: [] m_Father: {fileID: 0} @@ -5248,8 +5248,8 @@ MonoBehaviour: hasGlider: 1 hasGrapple: 1 hasWallrun: 1 - hasNitro: 0 - hasDash: 0 + hasNitro: 1 + hasDash: 1 playerPoints: 15 --- !u!1 &4061813754685703498 GameObject: @@ -5269,6 +5269,7 @@ GameObject: - component: {fileID: 4061813754685703344} - component: {fileID: 4061813754685703500} - component: {fileID: 4061813754685703499} + - component: {fileID: 4061813754685703501} m_Layer: 0 m_Name: T-Pose m_TagString: ArcherTarget @@ -5346,6 +5347,23 @@ MonoBehaviour: tempRelease: {x: 0, y: 0, z: 0} lerpRelease: {x: 0, y: 0, z: 0} forceDirection: {x: 0, y: 0, z: 0} + eHeld: 0 +--- !u!114 &4061813754685703501 +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: 5904903ff376f25499c08e24ad00aaf8, type: 3} + m_Name: + m_EditorClassIdentifier: + moveController: {fileID: 0} + pStats: {fileID: 0} + mSM: {fileID: 0} + dashItem: {fileID: 11400000, guid: 3156de54e455b4348b2a6e79383383b0, type: 2} --- !u!4 &4090990814600649861 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashCooldownState.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashCooldownState.cs index 1ba6736..aa78fb4 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashCooldownState.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashCooldownState.cs @@ -4,8 +4,12 @@ using UnityEngine; public class DashCooldownState : DashBaseState { - public override void EnterState(DashStateManager dSM, DashBaseState previousState){ + private CoolDown driver; + bool cooldown = false; + public override void EnterState(DashStateManager dSM, DashBaseState previousState){ + cooldown = false; + dSM.StartCoroutine(startCoolDown(dSM)); } public override void ExitState(DashStateManager dSM, DashBaseState nextState){ @@ -13,10 +17,21 @@ public class DashCooldownState : DashBaseState } public override void UpdateState(DashStateManager dSM){ - + if(cooldown && (dSM.mSM.currentState == dSM.mSM.RagdollState || dSM.mSM.currentState == dSM.mSM.RecoveringState || dSM.mSM.currentState == dSM.mSM.SlideState || dSM.mSM.currentState == dSM.mSM.CrouchState || dSM.mSM.currentState == dSM.mSM.CrouchWalkState)){ + dSM.SwitchState(dSM.IncapacitatedState); + } + else if(cooldown){ + dSM.SwitchState(dSM.NoneState); + } } public override void FixedUpdateState(DashStateManager dSM){ } + + private IEnumerator startCoolDown(DashStateManager dSM){ + //driver.startUICooldown(dashItem.name); + yield return new WaitForSeconds(dSM.dashItem.cooldownM); + cooldown = true; + } } diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashDashingState.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashDashingState.cs index d2c4c32..25c7928 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashDashingState.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashDashingState.cs @@ -4,19 +4,37 @@ using UnityEngine; public class DashDashingState : DashBaseState { - public override void EnterState(DashStateManager dSM, DashBaseState previousState){ + Vector3 moveDirection; + const float maxDashTime = 1.0f; + float dashDistance = 10; + float dashStoppingSpeed = 0.1f; + float currentDashTime = maxDashTime; + float dashSpeed = 12; + + public override void EnterState(DashStateManager dSM, DashBaseState previousState){ + currentDashTime = 0; } public override void ExitState(DashStateManager dSM, DashBaseState nextState){ - + moveDirection = Vector3.zero; } public override void UpdateState(DashStateManager dSM){ + if(currentDashTime < maxDashTime){ + moveDirection = dSM.transform.forward * dashDistance; + currentDashTime += dashStoppingSpeed; + } + else{ + dSM.SwitchState(dSM.CooldownState); + } + if(dSM.mSM.currentState == dSM.mSM.RagdollState || dSM.mSM.currentState == dSM.mSM.SlideState || dSM.mSM.currentState == dSM.mSM.CrouchState || dSM.mSM.currentState == dSM.mSM.CrouchWalkState){ + dSM.SwitchState(dSM.CooldownState); + } } public override void FixedUpdateState(DashStateManager dSM){ - + dSM.moveController.Move(moveDirection * Time.deltaTime * dashSpeed); } } diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashIncapacitatedState.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashIncapacitatedState.cs index 5344d10..fc91bb8 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashIncapacitatedState.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashIncapacitatedState.cs @@ -13,7 +13,9 @@ public class DashIncapacitatedState : DashBaseState } public override void UpdateState(DashStateManager dSM){ - + if(dSM.mSM.currentState != dSM.mSM.RagdollState && dSM.mSM.currentState != dSM.mSM.RecoveringState && dSM.mSM.currentState != dSM.mSM.SlideState && dSM.mSM.currentState != dSM.mSM.CrouchState && dSM.mSM.currentState != dSM.mSM.CrouchWalkState){ + dSM.SwitchState(dSM.NoneState); + } } public override void FixedUpdateState(DashStateManager dSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashNoneState.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashNoneState.cs index 84b813a..78ff873 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashNoneState.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/Dash/DashNoneState.cs @@ -13,7 +13,16 @@ public class DashNoneState : DashBaseState } public override void UpdateState(DashStateManager dSM){ + if(dSM.pStats.HasDash){ + if ((Input.GetKeyDown(KeyCode.R) || Input.GetAxis("Dash") != 0)){ + dSM.SwitchState(dSM.DashingState); + } + if(dSM.mSM.currentState == dSM.mSM.RagdollState || dSM.mSM.currentState == dSM.mSM.SlideState || dSM.mSM.currentState == dSM.mSM.CrouchState || dSM.mSM.currentState == dSM.mSM.CrouchWalkState){ + dSM.SwitchState(dSM.IncapacitatedState); + } + } + } public override void FixedUpdateState(DashStateManager dSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/DashStateManager.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/DashStateManager.cs index aff64e5..c7d0f11 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/DashStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugStateStuff/DashState/DashStateManager.cs @@ -31,6 +31,10 @@ public class DashStateManager : MonoBehaviour public MoveStateManager mSM; //// + ////Items Section + public SpecialItem dashItem; + //// + void Awake(){ ////Initialize Player Components