public virtual void HandFound() { if (activeObj) { activeObj.owner = null; // Clear reference stateController.ChangeState(activeObj.Activate(this)); } else { stateController.ChangeState(new LeapGodHandState()); } }
void Start() { handType = (HandTypeBase)Instantiate(handType, transform.position, Quaternion.identity); handType.SetOwner(this); handType.name = isRightHand ? "rightHand" : "leftHand"; renderer.enabled = false; // Disable visual indicator for Unityhand if (initialLeapObject) { initialLeapObject.gameObject.SetActive(true); handType.ChangeState(initialLeapObject.Activate(handType)); } originalPos = transform.localPosition; detectedFingers = new FingerDetection(this); InstantiateFingers(); Contro = GameObject.Find("Controller"); }
public override void OnTriggerStay(Collider c) { LeapGameObject obj = c.GetComponent <LeapGameObject>(); if (!handController.activeObj && obj) //if we're not already holding an object, continue checking closest object to select { HighlightClosest(obj); if (highlightObj != null && obj != highlightObj) { obj.DeSelect(); return; } // Deselect and exit function if this is not the highlighted object if (IsGrabbing() && (highlightObj.owner == null || highlightObj.canUseBothHands)) { highlightObj.DeSelect(); handController.ChangeState(highlightObj.Activate(handController)); } } }
void SwitchCam() { //switch to top down view if (count == 0) { camPlayerLeft.enabled = false; camPlayerRight.enabled = false; camTopLeft.enabled = true; camTopRight.enabled = true; questionText.transform.localPosition = new Vector3(-72.428f, -15.839f, -26.502f); questionText.transform.localRotation = Quaternion.Euler(90f, 0, 0); questionText.fontSize = 40; textBackground.transform.localPosition = new Vector3(-55.419f, 5.364f, -17.121f); textBackground.transform.localRotation = Quaternion.Euler(90f, 0, 0); textBackground.transform.localScale = new Vector3(1.4f, 0.257f, -.0226f); textBackground.renderer.enabled = true; questionText.renderer.enabled = true; } //switch to simulation view else if (count == 1) { camTopLeft.enabled = false; camTopRight.enabled = false; simulationLeft.enabled = true; simulationRight.enabled = true; //change parent leapController.transform.parent = simulationCamera.transform; leapController.transform.localPosition = new Vector3(0f, -0.75f, 0.25f); //no rotation leapController.transform.rotation = Quaternion.identity; //put scalpel in hand scalpel.gameObject.SetActive(true); hand.handType.ChangeState(scalpel.Activate(hand.handType)); //show question background questionText.transform.localPosition = new Vector3(-64.054f, 3.057f, .08837f); questionText.transform.localRotation = Quaternion.Euler(0f, 0, 0); questionText.fontSize = 24; textBackground.transform.localPosition = new Vector3(-55.419f, 5.419f, -14.358f); textBackground.transform.localRotation = Quaternion.Euler(0f, 0, 0); textBackground.transform.localScale = new Vector3(4.435f, 1f, -.0226f); textBackground.renderer.enabled = true; questionText.renderer.enabled = true; } //switch to player view else if (count == 2) { simulationLeft.enabled = false; simulationRight.enabled = false; camPlayerLeft.enabled = true; camPlayerRight.enabled = true; //change parent leapController.transform.parent = player.transform; leapController.transform.localPosition = new Vector3(0f, -0.5f, 1f); //no rotation leapController.transform.rotation = Quaternion.identity; //scalpel.gameObject.SetActive(false); //hand.handType.ChangeState(scalpel.Release(hand.handType)); scalpel.canRelease = true; scalpel.DeSelect(); scalpel.isStatePersistent = false; scalpel.Release(scalpel.owner); //disable question/background textBackground.renderer.enabled = false; questionText.renderer.enabled = false; } /* * if(this.tag == "Player") * { * Debug.Log ("here"); * GameObject topCamera = GameObject.Find("TopCamera/OVRCameraController"); * foreach(Camera cam in topCamera.GetComponentsInChildren<Camera>()) * cam.enabled = true; * * foreach(Camera cam in this.GetComponentsInChildren<Camera>()) * cam.enabled = false; * } * else * { * GameObject playerCamera = GameObject.Find("PlayerController/OVRCameraController"); * foreach(Camera cam in playerCamera.GetComponentsInChildren<Camera>()) * cam.enabled = true; * this.GetComponentInChildren<Camera>().enabled = false; * foreach(Camera cam in this.GetComponentsInChildren<Camera>()) * cam.enabled = false; * * }*/ }