26 lines
623 B
C#
26 lines
623 B
C#
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
/// <summary>
|
|
/// Used on vulnerable trigger zones for ships.
|
|
/// </summary>
|
|
public class TackleDetection : MonoBehaviour
|
|
{
|
|
[SerializeField] private TackleKind tackleKind;
|
|
public UnityEvent<TackleKind, Collider> TackleResponse;
|
|
|
|
/// <summary>
|
|
/// Invokes the fitting tackle response on trigger entered.
|
|
/// </summary>
|
|
/// <param name="collider"></param>
|
|
void OnTriggerEnter(Collider collider)
|
|
{
|
|
if (collider.tag != "Spike" && collider.tag != "Bumper")
|
|
{
|
|
return;
|
|
}
|
|
TackleResponse.Invoke(tackleKind, collider);
|
|
}
|
|
}
|
|
|
|
public enum TackleKind { Critical, Normal } |