Beispiel #1
0
    void Start()
    {
        ipc = new IPC("unity_demo");

        cube0 = GameObject.Find("Cube 0");
        cube1 = GameObject.Find("Cube 1");
        cube2 = GameObject.Find("Cube 2");
        cube3 = GameObject.Find("Cube 3");
        cube4 = GameObject.Find("Cube 4");

        ipc.SetUDPCallback(delegate(string message)
        {
            print(message);

            string[] data = message.Split('!');

            float.TryParse(data[0], out x0);
            float.TryParse(data[1], out y0);
            float.TryParse(data[2], out z0);

            float.TryParse(data[3], out x1);
            float.TryParse(data[4], out y1);
            float.TryParse(data[5], out z1);

            float.TryParse(data[6], out x2);
            float.TryParse(data[7], out y2);
            float.TryParse(data[8], out z2);

            float.TryParse(data[9], out x3);
            float.TryParse(data[10], out y3);
            float.TryParse(data[11], out z3);

            float.TryParse(data[12], out xCenter);
            float.TryParse(data[13], out yCenter);
            float.TryParse(data[14], out zCenter);

            return(1);
        });
    }