private void OnTriggerEnter(Collider other) { //adds orb to orbguns if (other.gameObject.layer == 9 && !taken) //layer 9 = Player { taken = true; OrbGun[] orbGuns = other.transform.root.GetComponentsInChildren <OrbGun>(); foreach (OrbGun orbGun in orbGuns) { orbGun.SetOrbActive(orbType, viveTrackpadMaterial); } VRPlayerController vrPlayerController = other.transform.root.GetComponent <VRPlayerController>(); if (vrPlayerController != null) { vrPlayerController.Vibration(ViveController.BOTH, 1.0f); } AudioSource.PlayClipAtPoint(takeSound, transform.position, 0.5f); meshRenderer.enabled = false; } }
public override void OnStartAuthority() { // attach the controller model to the tracked controller object on the local client if (hasAuthority) { trackedController = GameObject.Find(string.Format("Controller ({0})", side.ToString("G").ToLowerInvariant())); Helper.AttachAtGrip(trackedController.transform, transform); localPlayer = ClientScene.FindLocalObject(ownerId).GetComponent <VRPlayerController> (); steamDevice = SteamVR_Controller.Input((int)trackedController.GetComponent <SteamVR_TrackedObject>().index); } }
// Update is called once per frame void Update() { // TODO catch escape key and call pause game if (Input.GetKeyDown("escape") && CanPause) { if (CurrentState == GameState.Pause) { UnPause(); } else if (CurrentState == GameState.Play) { PauseGame(); } } // update session time during play if (CurrentState == GameState.Play) { SessionTime += Time.deltaTime; // switch between fast and slow segments if (PlayersVRType == VirtualRealityType.SteamVR) { if (Input.GetKeyDown("i")) { VRPlayerController pc = PlayerObj.GetComponentInChildren <VRPlayerController>(); if (pc != null) { pc.DegreeSegment = 5; } } if (Input.GetKeyDown("o")) { VRPlayerController pc = PlayerObj.GetComponentInChildren <VRPlayerController>(); if (pc != null) { pc.DegreeSegment = 2; } } if (Input.GetKeyDown("p")) { VRPlayerController pc = PlayerObj.GetComponentInChildren <VRPlayerController>(); if (pc != null) { pc.DegreeSegment = 1; } } } } }
public override void OnStartAuthority() { // attach the controller model to the tracked controller object on the local client if (hasAuthority) { trackedController = GameObject.Find(string.Format("Controller ({0})", side.ToString("G").ToLowerInvariant())); //Helper.AttachAtGrip(trackedController.transform, transform); gameObject.GetComponent <F_CopyXForms>().target = trackedController.transform; localPlayer = NetworkIdentity.spawned[ownerId].GetComponent <VRPlayerController>(); steamDevice = SteamVR_Controller.Input((int)trackedController.GetComponent <SteamVR_TrackedObject>().index); } }
// Start is called before the first frame update void Awake() { if (!_playerController) { _playerController = GetComponent <VRPlayerController>(); } if (!_rightHand) { _rightHand = _playerController.RightHand; } if (!_leftHand) { _leftHand = _playerController.LeftHand; } _rightGestureHand = _rightHand.GetComponent <ForceGestureHand>(); _leftGestureHand = _leftHand.GetComponent <ForceGestureHand>(); _rightClimbHand = _rightHand.GetComponent <ClimbHand>(); _leftClimbHand = _leftHand.GetComponent <ClimbHand>(); }
private void Start() { vrPlayerController = GetComponentInParent <VRPlayerController>(); }
//tutorial: tells player what to do, waits for action of player (moving, shooting, teleporting, switching orbs) private IEnumerator Introduction() { float delay = 1.0f; yield return(new WaitForSeconds(5.0f)); companion.StartSpeaking(audioClips[0]); yield return(new WaitForSeconds(audioClips[0].length + delay)); InvokeRepeating("CompanionSayImHere", 5.0f, 5.0f); while (!companion.IsVisibleByAnyCamera()) { yield return(null); } CancelInvoke("CompanionSayImHere"); yield return(new WaitForSeconds(1.0f)); companion.StartSpeaking(audioClips[2]); yield return(new WaitForSeconds(audioClips[2].length + delay)); Vector3 lastCameraPosition = Camera.main.transform.position; do { yield return(new WaitForSeconds(1.0f)); } while (lastCameraPosition == Camera.main.transform.position); companion.StartSpeaking(audioClips[3]); yield return(new WaitForSeconds(audioClips[3].length + delay)); Vector3 orbPosition = companion.transform.position + companion.transform.forward; orbPosition.y = 1.5f; paintOrb.transform.position = orbPosition; paintOrb.SetActive(true); while (!paintOrb.taken) { yield return(new WaitForSeconds(1.0f)); } companion.StartSpeaking(audioClips[4]); yield return(new WaitForSeconds(audioClips[4].length + delay)); VRPlayerController vrPlayerController = player.GetComponent <VRPlayerController>(); if (vrPlayerController != null) { vrPlayerController.SetTriggerHintActive(true); } do { yield return(new WaitForSeconds(1.0f)); } while (!paintOrbWasShot); if (vrPlayerController != null) { vrPlayerController.SetTriggerHintActive(false); } companion.StartSpeaking(audioClips[5]); yield return(new WaitForSeconds(audioClips[5].length + delay)); orbPosition = companion.transform.position + companion.transform.forward; orbPosition.y = 1.5f; teleportOrb.transform.position = orbPosition; teleportOrb.SetActive(true); while (!teleportOrb.taken) { yield return(new WaitForSeconds(1.0f)); } yield return(new WaitForSeconds(1.0f)); firstDoor.OpenDoor(); yield return(new WaitForSeconds(1.0f)); companion.StartSpeaking(audioClips[6]); yield return(new WaitForSeconds(audioClips[6].length + delay)); companion.SetAutoFollow(true); do { yield return(new WaitForSeconds(1.0f)); } while (!teleportOrbWasShot); yield return(new WaitForSeconds(1.0f)); companion.StartSpeaking(audioClips[7]); yield return(new WaitForSeconds(audioClips[7].length + delay)); orbChanged = false; if (vrPlayerController != null) { vrPlayerController.SetTouchpadHintActive(true); } do { yield return(new WaitForSeconds(1.0f)); } while (!orbChanged); if (vrPlayerController != null) { vrPlayerController.SetTouchpadHintActive(false); } companion.StartSpeaking(audioClips[8]); yield return(new WaitForSeconds(audioClips[8].length + delay)); yield return(new WaitForSeconds(1.0f)); secondDoor.OpenDoor(); yield return(new WaitForSeconds(1.0f)); companion.StartSpeaking(audioClips[9]); yield return(new WaitForSeconds(audioClips[9].length)); companion.SetIdle(true); yield return(null); }
private void Start() { _playerController = gameObject.GetComponent <VRPlayerController>(); _cameraRig = _playerController.GroundCheckerObj; }