private void HitCollider(RaycastHit2D hit) { LaserHit laserHit = new LaserHit() { hit = hit, laser = this }; hit.collider.SendMessage("OnLaserHit", laserHit, SendMessageOptions.DontRequireReceiver); }
public void OnLaserHit(LaserHit laserHit) { _laserHit = laserHit; if (_onLaserHit != null) { try { _onLaserHit.Invoke(); } catch (System.Exception e) { Debug.Log(e); } } _laserHit = null; }