/// <summary>
    /// Registers the listener to be executed at the end of all effects the game object contains.
    /// </summary>
    /// <param name="listener">IEffectListener instance</param>
    public static void registerAsEndEffect(IEffectListener listener)
    {
        Effect[] arr = listener.getEffects();
        if (arr == null)
        {
            return;
        }
        // get the Effect with less priority. It may happens all of them have same priority
        int    priority = -1;
        Effect last     = null;

        for (int i = 0, c = arr.Length; i < c; ++i)
        {
            if (priority < arr[i].priority && !arr[i].beforeLoadNextScene)
            {
                priority = arr[i].priority;
                last     = arr[i];
            }
        }
        // add the listener
        if (last != null)
        {
            last.addNextListener(listener);
        }
    }
Beispiel #2
0
 public void addNextListener(IEffectListener listener)
 {
     if (listeners == null)
     {
         listeners = new List <IEffectListener>();
     }
     listeners.Add(listener);
 }