private void InvokeOnLineOfSightEXit(ILOSSource losSource) { if (OnLineOfSightExit != null) { OnLineOfSightExit(gameObject, losSource); } }
private void InvokeOnLineOfSightEnter(ILOSSource losSource) { if (OnLineOfSightEnter != null) { OnLineOfSightEnter(gameObject, losSource); } }
private void InvokeOnLineOfSightStay(ILOSSource losSource) { if (OnLineOfSightStay != null) { OnLineOfSightStay(gameObject, losSource); } }
/// <summary> /// Updates the list with visible sources and trigger events if needed /// </summary> private void UpdateList(ILOSSource losSource, bool isVisible) { if (isVisible) { // LOS Source is already in list. if (m_VisibleSources.Contains(losSource)) { InvokeOnLineOfSightStay(losSource); } // LOS Source is added to list. else { m_VisibleSources.Add(losSource); InvokeOnLineOfSightEnter(losSource); } } else { // Source is removed from list. if (m_VisibleSources.Contains(losSource)) { m_VisibleSources.Remove(losSource); InvokeOnLineOfSightEXit(losSource); } } }