private void OnTriggerExit(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         TargetLost?.Invoke();
     }
 }
    void Untarget()
    {
        TargetLost?.Invoke();

        currentTarget.Died -= Untarget;
        currentTarget       = null;
        r2D.simulated       = true;
    }
Esempio n. 3
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.TryGetComponent(out Player player))
     {
         _target = null;
         TargetLost?.Invoke();
     }
 }
Esempio n. 4
0
 private void RemoveUndetectedTargets(List <Collider> targetsInFieldOfView)
 {
     for (int i = detectedTargets.Count - 1; i >= 0; --i)
     {
         Collider collider = detectedTargets[i];
         if (!targetsInFieldOfView.Contains(collider))
         {
             detectedTargets.RemoveAt(i);
             TargetLost?.Invoke(collider);
         }
     }
 }
Esempio n. 5
0
 void InvokeOnTargetLost(IRangeTarget target)
 {
     try
     {
         TargetLost?.Invoke(this, target);
     }
     catch (Exception e)
     {
         Urho.IO.Log.Write(LogLevel.Debug,
                           $"There was an unexpected exception during the invocation of {nameof(TargetLost)}: {e.Message}");
     }
 }
 private void FixedUpdate()
 {
     if (TargetIsClose())
     {
         transform.LookAt(_target);
         TargetFound?.Invoke();
     }
     else
     {
         TargetLost?.Invoke();
     }
 }
 private void OnTargetLost()
 {
     TargetInSight = false;
     TargetLost?.Invoke(_Player);
 }