using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerCollideAttack : MonoBehaviour { [SerializeField] Rigidbody2D body; [SerializeField] LayerMask damageLayers; [SerializeField] AnimationCurve speedToDamage; public float speedYouNeedToNotTakeDamageFromRammingOrSomtmh = 10f; public void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.tag != "Enemy") return; // Below was messing with assembly definitions //HealthComponent health = collision.collider.gameObject.GetComponent(); //if (health == null) // health = collision.collider.transform.parent.GetComponent(); //if (health == null) return; // health = collision.collider.gameObject.GetComponentInChildren(); //if (health == null) return; //float speed = body.velocity.magnitude; //float damage = speedToDamage.Evaluate(speed); //health.TakeDamage(damage); } }