Files
BepInEx/Projects/BanquetForFools/Source/Assembly-CSharp/LOS/LOSCuller.cs
2025-05-21 20:40:04 +02:00

71 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
namespace LOS
{
// Token: 0x02000104 RID: 260
[AddComponentMenu("Line of Sight/LOS Culler")]
public class LOSCuller : MonoBehaviour
{
// Token: 0x17000029 RID: 41
// (get) Token: 0x060015E6 RID: 5606 RVA: 0x0019C535 File Offset: 0x0019A735
// (set) Token: 0x060015E7 RID: 5607 RVA: 0x0019C53D File Offset: 0x0019A73D
public LayerMask RaycastLayerMask
{
get
{
return this.m_RaycastLayerMask;
}
set
{
this.m_RaycastLayerMask = value;
}
}
// Token: 0x1700002A RID: 42
// (get) Token: 0x060015E8 RID: 5608 RVA: 0x0019C546 File Offset: 0x0019A746
public bool Visibile
{
get
{
return this.m_IsVisible;
}
}
// Token: 0x060015E9 RID: 5609 RVA: 0x0019C54E File Offset: 0x0019A74E
private void OnEnable()
{
base.enabled &= Util.Verify(base.GetComponent<Renderer>() != null, "No renderer attached to this GameObject! LOS Culler component must be added to a GameObject containing a MeshRenderer or Skinned Mesh Renderer!");
}
// Token: 0x060015EA RID: 5610 RVA: 0x0019C573 File Offset: 0x0019A773
private void Update()
{
this.m_IsVisible = LOSCuller.CustomCull(base.gameObject.GetComponent<Renderer>().bounds, this.m_RaycastLayerMask.value);
}
// Token: 0x060015EB RID: 5611 RVA: 0x0019C59C File Offset: 0x0019A79C
private static bool CustomCull(Bounds meshBounds, int layerMask)
{
List<LOSSource> lossources = LOSManager.Instance.LOSSources;
for (int i = 0; i < lossources.Count; i++)
{
if (LOSHelper.CheckBoundsVisibility(lossources[i], meshBounds, layerMask))
{
return true;
}
}
return false;
}
// Token: 0x04002615 RID: 9749
[Tooltip("Selects which layers block raycasts used for visibility calculations")]
[SerializeField]
private LayerMask m_RaycastLayerMask = -1;
// Token: 0x04002616 RID: 9750
private bool m_IsVisible = true;
}
}