Esempio n. 1
0
    protected void ProcessPending(bool turnBegan)
    {
        List <PendingFunction> pending = turnBegan ? pendingBegin : pendingEnd;

        for (int i = pending.Count - 1; i >= 0; i--)
        {
            PendingFunction next = pending[i];
            next.turnsRemaining--;

            if (next.turnsRemaining == 0)
            {
                next.function(next.data);
                pending.RemoveAt(i);
            }
        }
    }
Esempio n. 2
0
    public void AddPending(int turns, Data data, EventDelegate func, bool onBegin)
    {
        if (turns <= 0)
        {
            return;
        }

        PendingFunction pending = new PendingFunction(turns, data, func);

        if (onBegin)
        {
            pendingBegin.Add(pending);
        }
        else
        {
            pendingEnd.Add(pending);
        }
    }