Space-Smash-Out/Assets/Scripts/TackleDetection.cs
2024-04-03 16:48:59 +02:00

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 }