1.1 --- a/SharpLibEar/Manager.cs Wed Aug 31 17:28:30 2016 +0200
1.2 +++ b/SharpLibEar/Manager.cs Wed Aug 31 20:20:32 2016 +0200
1.3 @@ -102,12 +102,38 @@
1.4 {
1.5 foreach (Event e in Events)
1.6 {
1.7 - if (e.Actions.Remove(aAction))
1.8 + if (RemoveObject(e,aAction))
1.9 {
1.10 //We removed our action, we are done here.
1.11 return;
1.12 }
1.13 }
1.14 }
1.15 +
1.16 + /// <summary>
1.17 + /// Remove the specified action from the event it belongs too.
1.18 + /// </summary>
1.19 + /// <param name="aAction"></param>
1.20 + private static bool RemoveObject(Object aCurrent, Object aToRemove)
1.21 + {
1.22 + //Exit condition
1.23 + if (aCurrent.Objects.Remove(aToRemove))
1.24 + {
1.25 + //We removed our action, we are done here.
1.26 + return true;
1.27 + }
1.28 +
1.29 + foreach (Object o in aCurrent.Objects)
1.30 + {
1.31 + bool done = RemoveObject(o, aToRemove);
1.32 + if (done)
1.33 + {
1.34 + return true;
1.35 + }
1.36 + }
1.37 +
1.38 + return false;
1.39 + }
1.40 +
1.41 }
1.42 }
1.43 \ No newline at end of file