public void VecIn(SpacebrewClient.SpacebrewMessage message) { Debug.Log("got message"); Debug.Log(message.valueNode); SimpleJSON.JSONArray arr = message.valueNode.AsArray; //switching from Z up to Unity's Y up prevDir.x = arr[0].AsFloat; prevDir.z = arr[1].AsFloat; prevDir.y = arr[2].AsFloat; if (applyTransform) { if (!invTransform) { prevDir = transform.rotation * prevDir; } else { prevDir = Quaternion.Inverse(transform.rotation) * prevDir; } } //lets assume sounds happen 1m above the ground Plane plane = new Plane(Vector3.up, Vector3.up); Ray ray = new Ray(transform.position, prevDir); float hitAt = 0; if (plane.Raycast(ray, out hitAt)) { hit = ray.origin + ray.direction * hitAt; onLocalized.Invoke(hit); } }
public void OnSpacebrewEvent(SpacebrewClient.SpacebrewMessage _msg) { //TODO: REMOVE THIS PRINT - DEBUG PURPOSE //print("Received Spacebrew Message (from: " + _msg.clientName + ")"); //print("name: " + _msg.name + ", type: " + _msg.type + ", value: " + _msg.value); messageReceiver.Receive(_msg); }
override public void Receive(SpacebrewClient.SpacebrewMessage message) { print("RECEIVED MESSAGE"); print("clientName: " + message.clientName); print("name: " + message.name); print("type: " + message.type); print("value: " + message.value); text.text = message.value; }
override public void Receive(SpacebrewClient.SpacebrewMessage message) { /* * print("RECEIVED MESSAGE"); * print("clientName: " + message.clientName); * print("name: " + message.name); * print("type: " + message.type); * print("value: " + message.value); */ if (message.type == "string") { gameController.processMessage(message.value); } }
public void OnSpacebrewEvent(SpacebrewClient.SpacebrewMessage _msg) { print("Received Spacebrew Message"); print(_msg); // Look for incoming Satellite messages if (_msg.name == "launchSatellite") { if (_msg.value == "true") { GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/CenterOfUniverse"); OrbitManager om = go.GetComponent <OrbitManager> (); om.makeSatellite(); print("Tried to launch Satellite"); } } // Look for messages to turn the virtual lamp light on if (_msg.name == "letters") { GameObject go = GameObject.Find("MatrixContainer"); // the name of your client object MatrixMaker grid = go.GetComponent <MatrixMaker> (); grid.ParseIncomingLetter(_msg.value[0].ToString()); grid.delayLayer(); } // Look for messages to turn the virtual lamp light on if (_msg.name == "lightOn") { //print(go); if (_msg.value == "true") { GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/Lamp/SpacebrewSpotlight"); lightState = !lightState; go.gameObject.SetActive(lightState); } } //if (_msg.name == "letters") { //print(go); //if (_msg.value == "true") { // GameObject go = GameObject.Find ("MatrixContainer"); // the name of your client object // MatrixMaker grid = go.GetComponent <MatrixMaker> (); // grid.CreateLayer(true); // grid.ParseIncomingString(_msg.value); }
public abstract void Receive(SpacebrewClient.SpacebrewMessage message);
public void OnSpacebrewEvent(SpacebrewClient.SpacebrewMessage _msg) { print("Received Spacebrew Message"); print(_msg.value); }
public void OnSpacebrewEvent(SpacebrewClient.SpacebrewMessage _msg) { print("Received Spacebrew Message"); print(_msg); //PITCH if (_msg.name == "Julius_Up") { //double check that something is actually coming through print("PitchUp got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P1/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(5, 0, 0); } if (_msg.name == "Julius_Down") { //double check that something is actually coming through print("PitchDown got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P1/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(-5, 0, 0); } //ROLL if (_msg.name == "Julius_Left") { //double check that something is actually coming through print("RollLeft got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P1/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(0, 0, -5); } if (_msg.name == "Julius_Right") { //double check that something is actually coming through print("RollRight got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P1/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(0, 0, 5); } /*//FISHING HOOK * if (_msg.name == "Julius_Line") { * //double check that something is actually coming through * print("Line got through!"); * * if (_msg.value == "true") { * //find in the hierarchy the object you want to be modified * GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P1/Pole/node-0/Fish_hook/node-0"); * * //move the hook in or out of the bathtub * distance += 0.01f; * * //define start position * Start_pos = go.gameObject.transform.position; * * //check where the hook is and move it consequently * if (hookUP == false){ * End_pos = Start_pos + new Vector3 (0, 500, 0); * } * else if (hookUP == true){ * End_pos = Start_pos - new Vector3 (0, 500, 0); * } * //once the hook has been move convert its position to the opposit of where it started from * go.gameObject.transform.position = Vector3.Lerp(Start_pos, End_pos, distance); * Start_pos = End_pos; * hookUP = !hookUP; * } */ //PITCH if (_msg.name == "Micol_Up") { //double check that something is actually coming through print("PitchUp got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P2/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(5, 0, 0); } if (_msg.name == "Micol_Down") { //double check that something is actually coming through print("PitchDown got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P2/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(-5, 0, 0); } //ROLL if (_msg.name == "Micol_Left") { //double check that something is actually coming through print("RollLeft got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P2/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(0, 0, -5); } if (_msg.name == "Micol_Right") { //double check that something is actually coming through print("RollRight got through!"); //find in the hierarchy the object you want to be modified GameObject go = GameObject.Find("BaseBoARd/YourObjectsGoHere/FishingPole_P2/Pole/node-0"); //affect its rotation go.gameObject.transform.Rotate(0, 0, 5); } }