Esempio n. 1
0
    public IEnumerator SendNow(MONO_Messenger[] messengers)
    {
        List<MONO_Messenger> messengersUnsorted = new List<MONO_Messenger>();
        List<MONO_Messenger> sortedMessengers = new List<MONO_Messenger>();

        foreach (MONO_Messenger currentMessenger in messengers)
        {
            messengersUnsorted.Add(currentMessenger);
        }

        sortedMessengers = messengersUnsorted.OrderBy(messenger => messenger.delay).ToList();

        float waited = 0;
        foreach (MONO_Messenger currentMessenger in sortedMessengers)
        {
            yield return new WaitForSeconds(currentMessenger.delay - waited);
            waited += currentMessenger.delay;
            currentMessenger.Send();
        }
    }
Esempio n. 2
0
    public void MessengerSend(MONO_Messenger[] messengersToSend)
    {
        if (messengersToSend != null)
            StartCoroutine(SendNow(messengersToSend));

    }