Пример #1
0
    //Get the currently selected robot and send it out for relay to the server.
    void Update()
    {
        float now_time = Time.time;

        if (now_time > old_time + 5)// Used for periodically checking which robot is being used
        {
            try
            {
                //Attempts to find a robot
                selected_robot = ray_caster.get_name();
            }
            catch
            {
                //If none found, default to none
                selected_robot = "None";
            }
        }
        //Set directly the name of the selected robot as an integer and return on the TCP server
        server.set_msg("$" + decode_str(selected_robot) + ";#\n");
    }
    void Update()
    {
        float now_time = Time.time;

        if (now_time > old_time + 5 && change_robot)
        {
            change_robot = !change_robot;
            image.GetComponent <Image>().color = new Color32(255, 0, 0, 100);
        }
        else if (change_robot)
        {
            try
            {
                selected_robot = ray_caster.get_name();
            }
            catch
            {
                selected_robot = "None";
            }
            output_text.text = selected_robot;
        }
    }