public override bool CheckCollision(Collider other) { var collided = false; var collider = other as CircleCollider; if (collider != null) { var distance = Vector2.Distance(Entity.GetComponent<Transform>().Position + Offset, collider.Entity.GetComponent<Transform>().Position + collider.Offset); if (distance <= Radius + collider.Radius) { OnCollideEvent(this, collider); collided = true; } } base.CheckCollision(other); return collided; }
protected void OnCollideEvent(Collider myCollider, Collider other) { CollideEvent?.Invoke(myCollider, other); }
public virtual bool CheckCollision(Collider other) { Checked = true; return true; }