Ejemplo n.º 1
0
    // Use this for initialization
    IEnumerator Start()
    {
        local_gui      = GameObject.Find("myGUI").GetComponentInChildren <myGUIScript> ();
        network_helper = GameObject.Find("myNetworkHelper").GetComponentInChildren <myNetworkHelperScript> ();

        if (this.myGUISkin == null)
        {
            local_gui.addDebug("Please assign a GUIskin on the editor!");
            this.enabled = false;
            yield return(false);
        }

        if (!Input.location.isEnabledByUser)
        {
            local_gui.addDebug("User has not enabled Location");
            yield return(false);
        }

        Input.location.Start(1f, 1f);

        // Wait until service initializes
        int maxWait = 20;

        while ((Input.location.status == LocationServiceStatus.Initializing) && (maxWait > 0))
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }

        // Service didn't initialize in 20 seconds
        if (maxWait < 1)
        {
            print("Timed out");
            yield return(false);
        }

        // Connection has failed
        if (Input.location.status == LocationServiceStatus.Failed)
        {
            local_gui.addDebug("Unable to determine device location");
            return(false);
        }
        else
        {
            local_gui.addDebug("Location: " + Input.location.lastData.latitude + " " +
                               Input.location.lastData.longitude + " " +
                               (long)Input.location.lastData.timestamp);
            working = true;
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    IEnumerator Start()
    {
        local_gui = GameObject.Find ("myGUI").GetComponentInChildren<myGUIScript> ();
        network_helper = GameObject.Find ("myNetworkHelper").GetComponentInChildren<myNetworkHelperScript> ();

        if (this.myGUISkin == null) {
            local_gui.addDebug ("Please assign a GUIskin on the editor!");
            this.enabled = false;
            yield return false;
        }

        if (!Input.location.isEnabledByUser) {
            local_gui.addDebug ("User has not enabled Location");
            yield return false;
        }

        Input.location.Start (1f, 1f);

        // Wait until service initializes
        int maxWait = 20;
        while ((Input.location.status == LocationServiceStatus.Initializing) && (maxWait > 0)) {
            yield return new WaitForSeconds (1);
            maxWait--;
        }

        // Service didn't initialize in 20 seconds
        if (maxWait < 1) {
            print ("Timed out");
            yield return false;
        }

        // Connection has failed
        if (Input.location.status == LocationServiceStatus.Failed) {
            local_gui.addDebug ("Unable to determine device location");
            return false;
        } else {
            local_gui.addDebug ("Location: " + Input.location.lastData.latitude + " " +
                                Input.location.lastData.longitude + " " +
                                (long)Input.location.lastData.timestamp);
            working = true;
        }
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        if (this.myGUISkin == null)
        {
            addDebug("Please assign a GUIskin on the editor!");
            this.enabled = false;
            return;
        }

        network_helper = GameObject.Find("myNetworkHelper").GetComponentInChildren <myNetworkHelperScript> ();

        group_name   = "jkw";
        drawing_name = "kappa";
        stroke_name  = 0;

        color_Picker = GameObject.FindObjectsOfType <ColorPicker> ();
        foreach (ColorPicker elem in color_Picker)
        {
            elem.useExternalDrawer = true;
        }
    }