Пример #1
0
    // Use this for initialization
    void Start()
    {
        GameObject go = GameObject.Find("SpacebrewObject");          // the name of your client object

        sbClient = go.GetComponent <SpacebrewClient> ();

        //GameObject hook = GameObject.Find ("SpacebrewObject"); // the name of your client object

        // register an event with the client and a callback function here.
        // COMMON GOTCHA: THIS MUST MATCH THE NAME VALUE YOU TYPED IN THE EDITOR!!
        //sbClient.addEventListener (this.gameObject, "launchSatellite");
        //sbClient.addEventListener (this.gameObject, "lightOn");
        //sbClient.addEventListener (this.gameObject, "letters");
        sbClient.addEventListener(this.gameObject, "Julius_Up");
        sbClient.addEventListener(this.gameObject, "Julius_Down");
        sbClient.addEventListener(this.gameObject, "Julius_Right");
        sbClient.addEventListener(this.gameObject, "Julius_Left");
        sbClient.addEventListener(this.gameObject, "Julius_Line");

        sbClient.addEventListener(this.gameObject, "Micol_Up");
        sbClient.addEventListener(this.gameObject, "Micol_Down");
        sbClient.addEventListener(this.gameObject, "Micol_Right");
        sbClient.addEventListener(this.gameObject, "Micol_Left");
        sbClient.addEventListener(this.gameObject, "Micol_Line");
    }
/*
 *
 * Ok, let's do this all in one script?
 *
 * BaseExample: None?
 * HelloWorld
 *      P: None
 *      S: launchSatellite, string
 * LightsButtons
 *      P: buttonPress, boolean
 *      S: flipLight, boolean
 * SenseHat
 *      P: letter, string
 *      S: direction, string
 *              up,down,left,right,middle (default)
 *      S: layer, string
 *
 * p:2
 * s:4
 *
 */


    // Use this for initialization
    void Start()
    {
        GameObject go = GameObject.Find("SpacebrewObject");          // the name of your client object

        sbClient = go.GetComponent <SpacebrewClient> ();

        // register an event with the client and a callback function here.
        // COMMON GOTCHA: THIS MUST MATCH THE NAME VALUE YOU TYPED IN THE EDITOR!!
        sbClient.addEventListener(this.gameObject, "launchSatellite");
        sbClient.addEventListener(this.gameObject, "flipLight");
        sbClient.addEventListener(this.gameObject, "letters");
    }