r2mods/ilspy_dump/ror2_csproj/RoR2.Projectile/MineProximityDetonator.cs

35 lines
722 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
namespace RoR2.Projectile;
public class MineProximityDetonator : MonoBehaviour
{
public TeamFilter myTeamFilter;
public UnityEvent triggerEvents;
public void OnTriggerEnter(Collider collider)
{
if (!NetworkServer.active || !collider)
{
return;
}
HurtBox component = collider.GetComponent<HurtBox>();
if (!component)
{
return;
}
HealthComponent healthComponent = component.healthComponent;
if ((bool)healthComponent)
{
TeamComponent component2 = healthComponent.GetComponent<TeamComponent>();
if (!component2 || component2.teamIndex != myTeamFilter.teamIndex)
{
triggerEvents?.Invoke();
}
}
}
}