32 lines
761 B
C#
32 lines
761 B
C#
using System.Reflection;
|
|
using log4net;
|
|
using Managers;
|
|
using UnityEngine;
|
|
|
|
public class PlayingFieldDetection : MonoBehaviour
|
|
{
|
|
private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
/// <summary>
|
|
/// Updates the match conditions, when a ship leaves the playing field.
|
|
/// </summary>
|
|
/// <param name="collider"></param>
|
|
private void OnTriggerExit(Collider collider)
|
|
{
|
|
if (collider.tag == "Ship")
|
|
{
|
|
if (!collider.TryGetComponent(out Ship ship))
|
|
{
|
|
Log.Error($"Collider: {collider} was tagged as Ship, but has no Ship component.");
|
|
return;
|
|
}
|
|
MatchManager.G.UpdateMatchCondition(new MatchConditionUpdate
|
|
{
|
|
Condition = WinCondition.Lives,
|
|
ship = ship,
|
|
count = -1
|
|
});
|
|
}
|
|
}
|
|
}
|