private void Update() { // Iterate through this when sending the Meshes (pieces of info) List <MeshList> listOfMeshList = new List <MeshList>(); MeshList sendList = new MeshList(); // Send upon keydown if (Input.GetKeyDown(KeyCode.Space)) { AddToList(sendList, listOfMeshList); foreach (MeshList list in listOfMeshList) { ClientUDP <MeshList> .UDPSend(1234, list); } } }
private void Update() { // This is for first movement in the sequence if (Input.GetKeyDown(KeyCode.A)) { testList.PList[4].Rotation = -45; testList.PList[5].Rotation = -45; testList.PList[8].Rotation = 90; testList.PList[9].Rotation = 90; ObjectJoint.SetJoints(testList, GameObject.Find("Sphere")); } // This is for the second movement in the sequence (repeate this and 3) if (Input.GetKeyDown(KeyCode.S)) { testList.PList[4].Rotation = 45; testList.PList[5].Rotation = 45; testList.PList[8].Rotation = -90; testList.PList[9].Rotation = -90; testList.PList[2].Rotation = -45; testList.PList[3].Rotation = -45; testList.PList[6].Rotation = 90; testList.PList[7].Rotation = 90; ObjectJoint.SetJoints(testList, GameObject.Find("Sphere")); } // Third movement in the sequence if (Input.GetKeyDown(KeyCode.D)) { testList.PList[4].Rotation = -45; testList.PList[5].Rotation = -45; testList.PList[8].Rotation = 90; testList.PList[9].Rotation = 90; testList.PList[2].Rotation = 45; testList.PList[3].Rotation = 45; testList.PList[6].Rotation = -90; testList.PList[7].Rotation = -90; GameObject root = GameObject.Find("Sphere"); root.transform.Translate(Vector3.left * Time.deltaTime * 100); ObjectJoint.SetJoints(testList, GameObject.Find("Sphere")); } #if ServerTesting // Configuring the robot with server test if (Input.GetKeyDown(KeyCode.A)) { RobotStructure test = ClientUDP <RobotStructure> .UDPSend(8888, testStructure); ConstructionManager.GenerateRobot(test); ObjectJoint.GetJoints(GameObject.Find("Sphere").GetComponent <ObjectJoint>().ChildObjectJoints, GameObject.Find("Sphere")); } // Moving the thing if (Input.GetKeyDown(KeyCode.Space)) { PositionListCreator.CreateList(GameObject.Find("Sphere"), testList.PList); PositionList newList = ClientUDP <PositionList> .UDPSend(7777, testList); ObjectJoint.SetJoints(newList, GameObject.Find("Sphere")); } #endif }