Example #1
0
	private bool SearchAndRemoveFromLinkedList(GraphicalEffect listHead, GraphicalEffect removed) {
		while (listHead.HasNextEffect()) {
			if (listHead.GetNextEffect() == removed) {
				listHead.RemoveNextEffect();
				return true;
			} else {
				listHead = listHead.GetNextEffect();
			}
		}
		return false;
	}
Example #2
0
 private bool SearchAndRemoveFromLinkedList(GraphicalEffect listHead, GraphicalEffect removed)
 {
     while (listHead.HasNextEffect())
     {
         if (listHead.GetNextEffect() == removed)
         {
             listHead.RemoveNextEffect();
             return(true);
         }
         else
         {
             listHead = listHead.GetNextEffect();
         }
     }
     return(false);
 }
Example #3
0
	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;
	}
Example #4
0
    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);
    }