From 62afc25653ca66cb177d5984420265af8b4079c0 Mon Sep 17 00:00:00 2001 From: Sveske Juice Date: Sat, 3 Feb 2024 12:38:42 -0800 Subject: [PATCH] zhen zync --- Assets/Resources/Player1.prefab | 1 + Assets/Resources/Player2.prefab | 1 + Assets/Scripts/Player/PlayerMovement.cs | 3 ++- Assets/Scripts/Rope/RopeSimulator.cs | 5 ++++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Assets/Resources/Player1.prefab b/Assets/Resources/Player1.prefab index 27feb4a..d7d06c0 100644 --- a/Assets/Resources/Player1.prefab +++ b/Assets/Resources/Player1.prefab @@ -225,6 +225,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3dbdb849a2f5df14d9e109a7776c5ac0, type: 3} m_Name: m_EditorClassIdentifier: + animationHandler: {fileID: 3878447480781341932} moveSpeed: 70 stepCooldown: 0.2 stepVibrationTime: 0.05 diff --git a/Assets/Resources/Player2.prefab b/Assets/Resources/Player2.prefab index 2c95419..d24e8e4 100644 --- a/Assets/Resources/Player2.prefab +++ b/Assets/Resources/Player2.prefab @@ -225,6 +225,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3dbdb849a2f5df14d9e109a7776c5ac0, type: 3} m_Name: m_EditorClassIdentifier: + animationHandler: {fileID: 3878447480781341932} moveSpeed: 65 stepCooldown: 0.2 stepVibrationTime: 0.05 diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 91247a5..621fc97 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -7,6 +7,7 @@ using System.Linq; [RequireComponent(typeof(PlayerInput))] public class PlayerMovement : MonoBehaviour { + public PlayerAnimationHandler animationHandler; public float moveSpeed = 5f; private Rigidbody2D rb; @@ -48,7 +49,7 @@ public class PlayerMovement : MonoBehaviour if (playerInput.movement != Vector2.zero) { RumbleWalk(); - GetComponent().Run(); + animationHandler.Run(); } } private void FixedUpdate() diff --git a/Assets/Scripts/Rope/RopeSimulator.cs b/Assets/Scripts/Rope/RopeSimulator.cs index 01a8948..a1a38d9 100644 --- a/Assets/Scripts/Rope/RopeSimulator.cs +++ b/Assets/Scripts/Rope/RopeSimulator.cs @@ -263,7 +263,10 @@ public class RopeSimulator : MonoBehaviour // Handle squeze kills foreach (var collider in colliderToSquezeForce) { - ISquezeDamageReceiver squezeDamageReceiver = collider.Key.GetComponent(); + ISquezeDamageReceiver squezeDamageReceiver = collider.Key.transform.root.GetComponent(); + if (squezeDamageReceiver == null) + squezeDamageReceiver = collider.Key.GetComponent(); + if (squezeDamageReceiver == null) continue; squezeDamageReceiver.TakeSquezeDamage(collider.Value * squezeDamage);