void Start_Now() { instance = this; Quaternion quatTiltAngle = new Quaternion(); quatTiltAngle.eulerAngles = new Vector3(-SensorAngle, 0.0f, 0.0f); kinectToWorld.SetTRS(new Vector3(0.0f, SensorHeight, 0.0f), quatTiltAngle, Vector3.one); UdpClient udpClient = new UdpClient(); try { IPAddress.Parse(ip_adress); } catch (Exception e) { Debug.Log("Napačen naslov!" + e); input.SetActive(true); return; } IPEndPoint ep = new IPEndPoint(IPAddress.Parse(ip_adress), 11000); udpClient.Connect(ep); udpClient.Send(new byte[] { 1 }, 1); //za posiljanje udpServerSend = new UdpClient(); remoteEPSend = new IPEndPoint(GameObject.Find("Canvas").GetComponent <CooplayerCoords>().remoteEP.Address, 13000); udpServerSend.Connect(remoteEPSend); AsyncCallback callback = null; callback = ar => { IPEndPoint newIncomingEndPoint = ep; byte[] data = udpClient.EndReceive(ar, ref newIncomingEndPoint); udpClient.BeginReceive(callback, null); String json = Encoding.ASCII.GetString(data, 0, data.Length); if (json == String.Empty) { Debug.Log("client koneccc"); reset = true; dvaObjekta[read] = null; } else { dvaObjekta[write] = JsonUtility.FromJson <humanBody>(json); sendForward(data); temp = read; read = write; write = temp; } }; udpClient.BeginReceive(callback, null); }
void Awake() { GameObject player = GameObject.Find("Canvas"); coords = player.GetComponent <clientRokoborba>(); playerAudio = GetComponent <AudioSource>(); //playerMovement = GetComponent<MyAvatarControllerRokoborba>(); // Set the initial health of the player. currentHealth = startingHealth; currentEnemyHealth = startingHealth; }
// Update the avatar each frame. public void Update() { if (!transform.gameObject.activeInHierarchy) { return; } // Get the KinectManager instance if (c == null) { c = clientRokoborba.Instance; } else if (c.reset) { Debug.Log("RESETIRAAAM"); c.reset = false; ResetToInitialPosition(); } // move the avatar to its Kinect position MoveAvatar(); for (var boneIndex = 0; boneIndex < bones.Length; boneIndex++) { if (!bones[boneIndex]) { continue; } if (boneIndex2JointMap.ContainsKey(boneIndex)) { clientRokoborba.SkeletonPositionIndex joint = boneIndex2JointMap[boneIndex]; TransformBone(joint, boneIndex); } } }
// Use this for initialization void Start() { GameObject player = GameObject.Find("Canvas"); coords = player.GetComponent <clientRokoborba>(); }