private bool SearchAndRemoveFromLinkedList(GraphicalEffect listHead, GraphicalEffect removed) { while (listHead.HasNextEffect()) { if (listHead.GetNextEffect() == removed) { listHead.RemoveNextEffect(); return true; } else { listHead = listHead.GetNextEffect(); } } return false; }
private bool SearchAndRemoveFromLinkedList(GraphicalEffect listHead, GraphicalEffect removed) { while (listHead.HasNextEffect()) { if (listHead.GetNextEffect() == removed) { listHead.RemoveNextEffect(); return(true); } else { listHead = listHead.GetNextEffect(); } } return(false); }
public bool Unschedule(GraphicalEffect effect) { bool found = false; foreach (KeyValuePair<float, GraphicalEffect> kvp in events) { if (kvp.Value == effect) { events.Remove(kvp.Key); found = true; if (effect.HasNextEffect()) { events.Add(kvp.Key, effect.GetNextEffect()); } } else if (SearchAndRemoveFromLinkedList(kvp.Value, effect)){ found = true; } } return found; }
public bool Unschedule(GraphicalEffect effect) { bool found = false; foreach (KeyValuePair <float, GraphicalEffect> kvp in events) { if (kvp.Value == effect) { events.Remove(kvp.Key); found = true; if (effect.HasNextEffect()) { events.Add(kvp.Key, effect.GetNextEffect()); } } else if (SearchAndRemoveFromLinkedList(kvp.Value, effect)) { found = true; } } return(found); }