Beispiel #1
0
    public void Update()
    {
        //processMessages has to be called on the main thread
        //so we used a shared proccessQueue full of OSC Messages
        lock (processQueue)
        {
            foreach (OSCMessage message in processQueue)
            {
                //  BroadcastMessage("OSCMessageReceived", message, SendMessageOptions.DontRequireReceiver);

                switch (message.Address)
                {
                case "/hotspot/id":
                    selectedId = message.Values[0].ToString();
                    break;

                case "/hotspot/status":
                    bool value;
                    if (message.Values.Count > 0)
                    {
                        bool.TryParse(message.Values[0].ToString(), out value);

                        HotspotValueChanged uDPRavenMessage = new HotspotValueChanged(null, selectedId, value);
                        Ravens.Send <RavenMessages.HotspotValueChanged>(uDPRavenMessage);
                    }
                    break;

                default:
                    break;
                }
            }
            processQueue.Clear();
        }
    }
 // Use this for initialization
 void Start()
 {
     Ravens.Subscribe <RavenMessages.HotspotValueChanged>((status) => {
         if (status.Address == ID)
         {
             GetComponent <SpriteRenderer>().color = status.Value ? Color.green : Color.gray;
         }
     });
 }
Beispiel #3
0
 public DelayedMessageList(Ravens r)
 {
     ravens = r;
 }