using System.Reflection; using log4net; using Managers; using UnityEngine; public class PlayingFieldDetection : MonoBehaviour { private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// Updates the match conditions, when a ship leaves the playing field. /// /// private void OnTriggerExit(Collider collider) { // TODO: This depends on a collider leaving the field which has only one // instance with the same tag on the ship object. if (collider.tag == "Ship") { if (!collider.TryGetComponent(out Ship shipComponent)) { Log.Error($"Collider: {collider} was tagged as Ship, but has no Ship component."); return; } MatchManager.G.UpdateMatchCondition(new MatchConditionUpdate { Condition = WinCondition.Lives, Ship = shipComponent, Count = -1 }); } } }