using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; using System.Linq; public class RopeWhipAttack : MonoBehaviour { [SerializeField] PlayerInput playerInput; public RopeWhipAttack otherPlayerAttack; public PlayerMovement playerMovement; public RopeJoint joint; public bool IsWhippingOtherPlayer => joint.locked; public bool IsBeingWhipped => otherPlayerAttack.joint.locked; public float initialDrag; private void Awake() { initialDrag = joint.body.drag; } private void Update() { // Other player is whip attacking if (otherPlayerAttack.joint.locked) return; if (playerInput.whipAttack) { joint.locked = true; otherPlayerAttack.joint.body.drag = 0f; } else { joint.locked = false; otherPlayerAttack.joint.body.drag = otherPlayerAttack.initialDrag; } } }