using System.Collections; using System.Collections.Generic; using UnityEngine; public class IsPushingTester: MonoBehaviour { private Animator animator; private Rigidbody2D rb; private bool isColliding; void Start() { animator = GetComponent(); rb = GetComponent(); isColliding = false; } void Update() { if (isColliding && rb.velocity.magnitude > 0.1f) { animator.SetBool("IsPushing", true); } else { animator.SetBool("IsPushing", false); } } void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("PressurePlatable") && collision.collider is EdgeCollider2D) { isColliding = true; } } void OnCollisionExit2D(Collision2D collision) { if (collision.gameObject.CompareTag("PressurePlatable") && collision.collider is EdgeCollider2D) { isColliding = false; } } }