diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index b7d4497..2e28085 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -1,4 +1,4 @@ - + @@ -78,6 +78,7 @@ + diff --git a/Assets/Animation/P_Run01.controller b/Assets/Animation/P_Run01.controller index cbf294a..8efa1e7 100644 --- a/Assets/Animation/P_Run01.controller +++ b/Assets/Animation/P_Run01.controller @@ -135,6 +135,31 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &-6621590539747483612 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: isCollapsed + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -1210443090960147805} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.7692308 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &-6059084907828803585 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -172,6 +197,7 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: 3261478500395500566} + - {fileID: -6621590539747483612} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -251,9 +277,6 @@ AnimatorStateTransition: - m_ConditionMode: 1 m_ConditionEvent: isJumping m_EventTreshold: 0 - - m_ConditionMode: 2 - m_ConditionEvent: isRunning - m_EventTreshold: 0 m_DstStateMachine: {fileID: 0} m_DstState: {fileID: -5449330869365902308} m_Solo: 0 @@ -303,8 +326,7 @@ AnimatorState: m_Name: playerCollapse m_Speed: 1 m_CycleOffset: 0 - m_Transitions: - - {fileID: 7973517625427532113} + m_Transitions: [] m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -758,28 +780,3 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1101 &7973517625427532113 -AnimatorStateTransition: - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_Conditions: - - m_ConditionMode: 2 - m_ConditionEvent: isCollapsed - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 7407206800022927606} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0.25 - m_TransitionOffset: 0 - m_ExitTime: 0.8148148 - m_HasExitTime: 1 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index ec71099..3e89639 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -17,6 +17,7 @@ GameObject: - component: {fileID: 3659140714710275197} - component: {fileID: 9133098163257611752} - component: {fileID: 4619270190355407300} + - component: {fileID: 72138333084358172} m_Layer: 6 m_Name: Player m_TagString: Untagged @@ -275,6 +276,18 @@ Animator: m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorStateOnDisable: 0 m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &72138333084358172 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3937090937419967315} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fdb391b004c27a64da8f6922aab5512e, type: 3} + m_Name: + m_EditorClassIdentifier: '::' --- !u!1 &6898135930931977916 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Experiment.unity b/Assets/Scenes/Experiment.unity index 78e89ed..3388cc2 100644 --- a/Assets/Scenes/Experiment.unity +++ b/Assets/Scenes/Experiment.unity @@ -1244,7 +1244,7 @@ AudioSource: m_PlayOnAwake: 1 m_Volume: 1 m_Pitch: 1 - Loop: 0 + Loop: 1 Mute: 0 Spatialize: 0 SpatializePostEffects: 0 @@ -3033,5 +3033,4 @@ SceneRoots: - {fileID: 2100000101} - {fileID: 2200000001} - {fileID: 491328828} - - {fileID: 393625611} - {fileID: 738367608} diff --git a/Assets/Scripts/PlayerAnimationController.cs b/Assets/Scripts/PlayerAnimationController.cs new file mode 100644 index 0000000..99e2a79 --- /dev/null +++ b/Assets/Scripts/PlayerAnimationController.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +public class PlayerAnimationController : MonoBehaviour +{ + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/PlayerAnimationController.cs.meta b/Assets/Scripts/PlayerAnimationController.cs.meta new file mode 100644 index 0000000..a63b0e2 --- /dev/null +++ b/Assets/Scripts/PlayerAnimationController.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fdb391b004c27a64da8f6922aab5512e \ No newline at end of file diff --git a/Assets/Scripts/PlayerPlatformerController.cs b/Assets/Scripts/PlayerPlatformerController.cs index 189cffa..1d5c042 100644 --- a/Assets/Scripts/PlayerPlatformerController.cs +++ b/Assets/Scripts/PlayerPlatformerController.cs @@ -20,6 +20,7 @@ public class PlayerPlatformerController : MonoBehaviour private PlayerStressController playerStressController; private PlayerPickupController playerPickupController; + private Animator animator; private Rigidbody2D body; private BoxCollider2D bodyCollider; @@ -39,6 +40,7 @@ public class PlayerPlatformerController : MonoBehaviour bodyCollider = GetComponent(); playerStressController = GetComponent(); playerPickupController = GetComponent(); + animator = GetComponent(); } private void OnEnable() @@ -98,6 +100,11 @@ public class PlayerPlatformerController : MonoBehaviour private void FixedUpdate() { + if(IsGrounded()) + { + animator.SetBool("isJumping", false); + } + if (healAction == null) return; currentHealCoolDown++; @@ -117,19 +124,25 @@ public class PlayerPlatformerController : MonoBehaviour if (healAction.IsPressed()) { - if(playerPickupController.heldObject != null) + animator.SetBool("isBreathing", true); + + if (playerPickupController.heldObject != null) { playerPickupController.DropObject(false); } if (canHeal) { - playerStressController.ReduceStress(1f); + playerStressController.ReduceStress(3f); canHeal = false; } return; } + else + { + animator.SetBool("isBreathing", false); + } var input = moveAction.ReadValue(); if (Mathf.Abs(input.x) > 0.01f) @@ -139,6 +152,23 @@ public class PlayerPlatformerController : MonoBehaviour var velocity = body.linearVelocity; velocity.x = input.x * moveSpeed; body.linearVelocity = velocity; + + if(velocity.x != 0) + { + animator.SetBool("isRunning", true); + if (velocity.x > 0 && IsGrounded()) + { + transform.localScale = new Vector3(.25f, .25f, .25f); + } + else + { + transform.localScale = new Vector3(-.25f, .25f, .25f); + } + } + else + { + animator.SetBool("isRunning", false); + } } private void OnJumpPerformed(InputAction.CallbackContext context) @@ -154,6 +184,8 @@ public class PlayerPlatformerController : MonoBehaviour velocity.y = 0f; body.linearVelocity = velocity; body.AddForce(Vector2.up * jumpImpulse, ForceMode2D.Impulse); + + animator.SetBool("isJumping", true); } private bool ShouldFilterDevices() diff --git a/Assets/Scripts/PlayerStressController.cs b/Assets/Scripts/PlayerStressController.cs index 668711d..7cdf286 100644 --- a/Assets/Scripts/PlayerStressController.cs +++ b/Assets/Scripts/PlayerStressController.cs @@ -7,7 +7,8 @@ using UnityEngine; public class PlayerStressController : MonoBehaviour { public PlayerPickupController pickupController; - + private Animator animator; + [Header("Stress Settings")] public float currentStress = 0f; public float maxStress = 100f; @@ -25,6 +26,7 @@ public class PlayerStressController : MonoBehaviour void Start() { + animator = GetComponent(); // Start the repeating loop StartCoroutine(StressCheckLoop()); } @@ -76,6 +78,8 @@ public class PlayerStressController : MonoBehaviour { isPanicking = true; + animator.SetBool("isCollapsed", true); + Debug.Log("Player is freaking out man!"); // Add effects like screen shake or slowing down the player here OnPlayerPanic?.Invoke(); // Trigger the panic event