void UpdateContextStatus(MultiContextPhase phase, ref int activeContextCount) { if (phase == null || !phase.IsActive) { return; } for (var i = 0; i < phase.ContextCount; ++i) { var isActive = phase.ContextActiveStatuses[i]; if (isActive) { var context = phase.Contexts[i]; UpdateContextStatus(phase, i, context, ref activeContextCount); } } }
void UpdateContextStatus(MultiContextPhase phase, int index, SpellPhaseContext context, ref int activeContextCount) { if (context == null || context.ContextOwner == null) { // context was active but carrier object or ContextOwner have been removed phase.CleanUp(index); } else if (context.TimeLeft <= 0) { // context expired phase.NotifyEnd(index); } else { // context is still active ++activeContextCount; } }