I managed to review the changes..
I saw you've chosen to keep a mTemp to the old onFinished list and reset the onFinished list..
I am not sure this is the best idea because:
- the onFinished list of delegates will clear, no matter if the EventDelegate is set to oneShot or not (this basically renders oneShot obsolete)
- this should fix the problem for the UITweener classes but not for the other classes that use EventDelegate.Execute
- I think the fix should be done in the EventDelegate.Execute method and the clone of the list should be done there
Please consider my arguments and let me know if I need to further explain the issue.
Here is a proposed solution for the EventDelegate.Execute method. This would eliminate the need of cloning the array in UITweener and the rest of the classes that use the Execute method. I think the performance decrease would be minimal since most of the time there are only 1 delegates added to the onFinished method.
static public void Execute (List<EventDelegate> list)
{
if (list != null)
{
// Creates a clone of the event delegate list
List
<EventDelegate
> mTemp
= new List
<EventDelegate
>(); mTemp.AddRange(list);
for (int i = 0; i < mTemp.Count; i++)
{
EventDelegate del = mTemp[i];
if (del != null)
{
del.Execute();
if (del.oneShot)
{
list.Remove(del);
}
}
}
}
}