//public void OnCollisionEnter(Collision collision) //{ // isDouble = (Time.realtimeSinceStartup - lastShot < doubleInterval); // if (!isDouble && Time.realtimeSinceStartup - lastShot < interval) return; // LeapBoxingObject leapObj = collision.gameObject.GetComponent<LeapBoxingObject>(); // if (leapObj) // { // //Debug.Log("mang : " + leapObj.maxVelocity.magnitude); // //Debug.Log("velo : " + leapObj.maxVelocity); // //Debug.Log("norm : " + leapObj.maxVelocity.normalized); // //Debug.Log("dir : " + (collision.transform.position - transform.position)); // //if (leapObj.maxVelocity.z > 0) return; // //Debug.Log(leapObj.maxVelocity.magnitude); // Vector3 initPos = (Vector3.up * 2) + (Camera.main.transform.forward * 5); // mentosCopy = Instantiate(mentos, collision.gameObject.transform.position, Quaternion.identity) as GameObject; // mentosCopy.transform.position += initPos; // mentosCopy.rigidbody.AddForce(Camera.main.transform.forward * force); // if (isDouble) // { // mentosCopy = Instantiate(mentos, collision.gameObject.transform.position, Quaternion.identity) as GameObject; // mentosCopy.transform.position += (Camera.main.transform.right * 3) + initPos; // mentosCopy.rigidbody.AddForce(Camera.main.transform.forward * force); // mentosCopy = Instantiate(mentos, collision.gameObject.transform.position, Quaternion.identity) as GameObject; // mentosCopy.transform.position += -(Camera.main.transform.right * 3) + initPos; // mentosCopy.rigidbody.AddForce(Camera.main.transform.forward * force); // } // lastShot = Time.realtimeSinceStartup; // } //} void Start() { LeapHandController hc = GameObject.Find("Leap Controller Multiple/_leapController").GetComponent<LeapHandController>(); ind1 = GameObject.Find("OVRCameraController/CameraLeft/h1Ind").renderer; ind2 = GameObject.Find("OVRCameraController/CameraRight/h2Ind").renderer; nt = GameObject.Find("Networking").GetComponent<Networking>(); h1 = hc.unityHands[0]; h2 = hc.unityHands[1]; _mechaController = GameObject.Find("Mecha").GetComponent<UpdateMechaRotation>(); interval = _mechaController.animation.GetClip("Left Shot").length; }
void Awake() { Application.runInBackground = true; spawner = GameObject.Find("Spawner").GetComponent<Spawner>(); ns = GameObject.Find("Networking").GetComponent<NetworkingServer>(); _ps = transform.FindChild("Puskur").particleSystem; if (ns == null) { _mechaController = GameObject.Find("Mecha").GetComponent<UpdateMechaRotation>(); } _ps.enableEmission = false; StartCoroutine("TimeOut"); }