public override void Update()
{
base.Update();
// Account for triggers that are destroyed or deactivated when the ability is active.
if ((m_ObjectDetection & ObjectDetectionMode.Trigger) != 0) {
for (int i = 0; i < m_DetectedTriggerObjectsCount; ++i) {
if (m_DetectedTriggerObjects[i] == null || !m_DetectedTriggerObjects[i].activeInHierarchy) {
m_DetectedTriggerObjects[i] = null;
// Ensure there is not a gap in the trigger object elements.
for (int j = i; j < m_DetectedTriggerObjectsCount - 1; ++j) {
m_DetectedTriggerObjects[j] = m_DetectedTriggerObjects[j + 1];
}
m_DetectedTriggerObjectsCount--;
// The detected object should be assigned to the oldest trigger object. This value may be null.
DetectedObject = m_DetectedTriggerObjects[0];
}
}
}
}