Example #1
0
    protected override void OnReceive(object message)
    {
        if (message.GetType() == _matcher.GetType())
        {
            Sender.Tell(_answer);
            count += 1;
            if (count % 100000 == 0)
            {
                UnityEngine.Debug.Log(Thread.CurrentThread.ManagedThreadId + ": " + count.ToString("N0") +
                                      ": received " + message.ToString() + " answering " +
                                      _answer);

                uiManager = uiManager.OrElse(MonoBehaviourActor.getActorRef(_uiManagerPath, AkkaSystem.Instance.GetActorSystem()));
                int time = timeMessages.Elapsed.Milliseconds;
                timeMessages = Stopwatch.StartNew();
                UIMessages.SpeedInfo msg = new UIMessages.SpeedInfo(100000 / time * 1000);
                UnityEngine.Debug.LogFormat("about to send {0} to the UIManager {1}", msg, uiManager);
                uiManager.ForEach(a => a.Tell(msg, Self));
            }
        }
    }