Пример #1
0
        private void HitCollider(RaycastHit2D hit)
        {
            LaserHit laserHit = new LaserHit()
            {
                hit   = hit,
                laser = this
            };

            hit.collider.SendMessage("OnLaserHit", laserHit, SendMessageOptions.DontRequireReceiver);
        }
Пример #2
0
 public void OnLaserHit(LaserHit laserHit)
 {
     _laserHit = laserHit;
     if (_onLaserHit != null)
     {
         try
         {
             _onLaserHit.Invoke();
         }
         catch (System.Exception e)
         {
             Debug.Log(e);
         }
     }
     _laserHit = null;
 }