diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index f45c097..a34e916 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -1483,101 +1483,6 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1019290559} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &1050795626 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1050795630} - - component: {fileID: 1050795629} - - component: {fileID: 1050795628} - - component: {fileID: 1050795627} - m_Layer: 0 - m_Name: Cube (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!65 &1050795627 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1050795626} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &1050795628 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1050795626} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &1050795629 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1050795626} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1050795630 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1050795626} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 24.3, y: 0.6, z: 43} - m_LocalScale: {x: 1, y: 2, z: 10} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 12 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1125832108 GameObject: m_ObjectHideFlags: 0 @@ -2040,101 +1945,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1204441710 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1204441714} - - component: {fileID: 1204441713} - - component: {fileID: 1204441712} - - component: {fileID: 1204441711} - m_Layer: 0 - m_Name: Cube - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!65 &1204441711 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1204441710} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &1204441712 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1204441710} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &1204441713 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1204441710} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1204441714 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1204441710} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 31.334904, y: 5.3, z: 43} - m_LocalScale: {x: 1, y: 10, z: 20} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 11 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1257935739 GameObject: m_ObjectHideFlags: 0 @@ -3128,6 +2938,72 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2059816015 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2059816018} + - component: {fileID: 2059816017} + - component: {fileID: 2059816016} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2059816016 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2059816015} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &2059816017 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2059816015} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &2059816018 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2059816015} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2061208975 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs index 71c6d10..e121db4 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs @@ -4,19 +4,17 @@ using UnityEngine; public class dAerialGlidingState : dAerialBaseState { - float tempTraction; // temp traction to store the actual player traction public override void EnterState(dAerialStateManager aSM, dAerialBaseState previousState){ //Modify base traction - tempTraction = aSM.pStats.Traction; - aSM.pStats.Traction = 1.0f; + aSM.pStats.CurTraction = 1.0f; } public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){ //return traction to normal - aSM.pStats.Traction = tempTraction; + aSM.pStats.CurTraction = aSM.pStats.Traction; } public override void UpdateState(dAerialStateManager aSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs index f0494a1..617f3c6 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs @@ -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); } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs index 605da20..67d7319 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs @@ -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){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNitroingState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNitroingState.cs index e4c856d..ae592cf 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNitroingState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNitroingState.cs @@ -7,19 +7,17 @@ public class dNitroNitroingState : dNitroBaseState private float tempTimer; // temporary timer private float actualMaxVel; // actual max velocity - private float actualAcc; // actual acceleration public override void EnterState(dNitroStateManager nSM, dNitroBaseState previousState){ actualMaxVel = nSM.pStats.MaxVel; // saves previous max velocity - actualAcc = nSM.pStats.Acc; // saves previous max acc - nSM.pStats.Acc += nSM.nitroAccBoost; // increases acceleration + nSM.pStats.CurAcc += nSM.nitroAccBoost; // increases acceleration nSM.pStats.MaxVel += nSM.nitroVelBoost; // increases max velocity tempTimer = 5; // how long we will be sped up } public override void ExitState(dNitroStateManager nSM, dNitroBaseState nextState){ - nSM.pStats.Acc = actualAcc; // reset acceleration + nSM.pStats.CurAcc = nSM.pStats.Acc; // reset acceleration nSM.pStats.MaxVel = actualMaxVel; // reset maximum velocity } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGlidingState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGlidingState.cs index dbfcca1..cc9e91d 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGlidingState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGlidingState.cs @@ -4,19 +4,17 @@ using UnityEngine; public class AerialGlidingState : AerialBaseState { - float tempTraction; // temp traction to store the actual player traction public override void EnterState(AerialStateManager aSM, AerialBaseState previousState){ //Modify base traction - tempTraction = aSM.pStats.Traction; - aSM.pStats.Traction = 1.0f; + aSM.pStats.CurTraction = 1.0f; } public override void ExitState(AerialStateManager aSM, AerialBaseState nextState){ //return traction to normal - aSM.pStats.Traction = tempTraction; + aSM.pStats.CurTraction = aSM.pStats.Traction; } public override void UpdateState(AerialStateManager aSM){ diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs index 1e2acce..dfad391 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs @@ -114,6 +114,8 @@ public class MoveStateManager : NetworkBehaviour if (!IsLocalPlayer) { return; } Cursor.lockState = CursorLockMode.Locked; // Lock cursor on start if you are the local player + pStats.CurTraction = pStats.Traction; + pStats.CurAcc = pStats.Acc; } // Update is called once per frame @@ -178,7 +180,7 @@ public class MoveStateManager : 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 @@ -219,7 +221,7 @@ public class MoveStateManager : NetworkBehaviour Debug.DrawRay(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, moveXZ.normalized * 1f, Color.red); Debug.DrawRay(gameObject.transform.position + new Vector3(0,2.2f,0) + rayOffset, moveXZ.normalized * 1f, 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; } @@ -238,7 +240,7 @@ public class MoveStateManager : 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 movecontroller involved for correct movement if(currentState == CrouchState){ diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs index df9d282..2f4f89d 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs @@ -5,16 +5,14 @@ using UnityEngine; public class MoveSlideState : MoveBaseState { //Slide Variables - float originalTraction; // Traction before slide started RaycastHit slideRay; // slide raycast public override void EnterState(MoveStateManager mSM, MoveBaseState 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,14 +23,14 @@ public class MoveSlideState : MoveBaseState 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); } //if state is crouch revert traction else{ - mSM.pStats.Traction = originalTraction; + mSM.pStats.CurTraction = mSM.pStats.Traction; } } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNitroingState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNitroingState.cs index 0bc7ddd..6202f4e 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNitroingState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNitroingState.cs @@ -7,19 +7,18 @@ public class NitroNitroingState : NitroBaseState private float tempTimer; // temporary timer private float actualMaxVel; // actual max velocity - private float actualAcc; // actual acceleration public override void EnterState(NitroStateManager nSM, NitroBaseState previousState){ actualMaxVel = nSM.pStats.MaxVel; // saves previous max velocity - actualAcc = nSM.pStats.Acc; // saves previous max acc - nSM.pStats.Acc += nSM.nitroAccBoost; // increases acceleration + + nSM.pStats.CurAcc += nSM.nitroAccBoost; // increases acceleration nSM.pStats.MaxVel += nSM.nitroVelBoost; // increases max velocity tempTimer = 5; // how long we will be sped up } public override void ExitState(NitroStateManager nSM, NitroBaseState nextState){ - nSM.pStats.Acc = actualAcc; // reset acceleration + nSM.pStats.CurAcc = nSM.pStats.Acc; // reset acceleration nSM.pStats.MaxVel = actualMaxVel; // reset maximum velocity } diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index 6015996..bf490fa 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -5,6 +5,9 @@ using UnityEngine.Assertions; public class PlayerStats : MonoBehaviour { + + public enum Weather {Rain, Snow, Wind, Fog}; + //Soft cap max speed a player can achieve they can achieve this speed by running [SerializeField] private float maxVel = 40.0f; public float MaxVel{ @@ -40,6 +43,12 @@ public class PlayerStats : MonoBehaviour set{ acc = value; } } + [SerializeField] private float curAcc; + public float CurAcc{ + get{ return curAcc; } + set{ curAcc = value;} + } + //Player Jump power [SerializeField] private float jumpPow = 60.0f; public float JumpPow{ @@ -61,6 +70,12 @@ public class PlayerStats : MonoBehaviour set{ traction = value; } } + [SerializeField] private float curTraction; + public float CurTraction{ + get{ return curTraction; } + set{ curTraction = value; } + } + //Player Kick Power [SerializeField] private float kickPow = 500.0f; public float KickPow{ @@ -131,6 +146,87 @@ public class PlayerStats : MonoBehaviour set{ playerPoints = value; } } + [SerializeField] private bool windOn = false; + public bool WindOn{ + get{ return windOn; } + } + + private float tempTraction; + private float tempAcc; + private float accModification; + + public void SetWeather(Weather weather){ + switch(weather){ + case Weather.Rain:{ + Debug.Log("Rain"); + + tempTraction = traction; + tempAcc = acc; + + traction -= 2; + if(curTraction - 2 > 0){ + curTraction -= 2; + } + + acc += 2; + curAcc += 2; + accModification = 2; + + break; + } + + case Weather.Snow:{ + Debug.Log("Snow"); + + tempTraction = traction; + tempAcc = acc; + + traction += 2; + if(curTraction > .01 && curTraction != 1){ + curTraction += 2; + } + + acc *= .5; + curAcc *= .5; + accModification = -acc; + + break; + } + + case Weather.Wind:{ + Debug.Log("Wind"); + windOn = true; + break; + } + + case Weather.Fog:{ + Debug.Log("Fog"); + break; + } + + default:{ + Debug.Log("Incorrect thing passed in"); + break; + } + + } + } + + public void ClearWeather(){ + + acc = tempAcc; + traction = tempTraction; + + if(curTraction > .01 && curTraction != 1){ + curTraction = traction; + } + + curAcc -= accModification; + + windOn = false; + + } + void Update(){ VariableValidation(); } diff --git a/Assets/Scripts/UI/WeatherWheel.cs b/Assets/Scripts/UI/WeatherWheel.cs index 80523da..14fd6f5 100644 --- a/Assets/Scripts/UI/WeatherWheel.cs +++ b/Assets/Scripts/UI/WeatherWheel.cs @@ -10,7 +10,7 @@ public class WeatherWheel : MonoBehaviour { void Update() { if (isSpinning) { - transform.Rotate(0, 0, wheelSpeed, Space.World); + transform.Rotate(0, 0, wheelSpeed); wheelSpeed -= subtractSpeed; } @@ -28,28 +28,28 @@ public class WeatherWheel : MonoBehaviour { Debug.Log("Snow"); // Set angle back to centered - transform.rotation = Quaternion.Euler(0, 0, 0); + transform.localRotation = Quaternion.Euler(0, 0, 0); } else if (finalAngle > 45 && finalAngle <= 135) { // Windy // TODO: Trigger Wind Debug.Log("Windy"); // Set angle back to centered - transform.rotation = Quaternion.Euler(0, 0, 90); + transform.localRotation = Quaternion.Euler(0, 0, 90); } else if (finalAngle > 135 && finalAngle <= 225) { // Fog // TODO: Trigger Fog Debug.Log("Fog"); // Set angle back to centered - transform.rotation = Quaternion.Euler(0, 0, 180); + transform.localRotation = Quaternion.Euler(0, 0, 180); } else if (finalAngle > 225 && finalAngle <= 315) { // Rain // TODO: Trigger Rain Debug.Log("Rain"); // Set angle back to centered - transform.rotation = Quaternion.Euler(0, 0, 270); + transform.localRotation = Quaternion.Euler(0, 0, 270); } } } diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 4ef34b9..13c8f46 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -24,16 +24,16 @@ EditorUserSettings: value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-6: - value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb + value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb flags: 0 RecentlyUsedScenePath-7: value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb flags: 0 RecentlyUsedScenePath-8: - value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 + value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb flags: 0 RecentlyUsedScenePath-9: - value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb + value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 flags: 0 vcSharedLogLevel: value: 0d5e400f0650