IEnumerator ChangeCamera() { if (_animator && !_animator.enabled && !_doorsOpened.Contains(this.transform.name)) { _animator.enabled = true; _player.enabled = false; _finalCamera.enabled = true; _player.GetComponentInChildren <Camera>().enabled = false; yield return(new WaitForSeconds(4f)); if (_gameOverImage && _isFinalDoor) { _gameOverImage.enabled = true; _gameOverImage.GetComponent <Animator>().enabled = true; } else { _animator.enabled = false; _player.enabled = true; _finalCamera.enabled = false; _player.GetComponentInChildren <Camera>().enabled = true; if (_gameOverImage && _isFinalDoor) { _gameOverImage.enabled = false; _gameOverImage.GetComponent <Animator>().enabled = false; } _doorsOpened.Add(this.transform.name); StaticActions.Checks.Clear(); } } }
void SpawnMyPlayer() { GameObject myPlayer = PhotonNetwork.Instantiate("FPSController", RandomSpawnVector3(), Quaternion.identity, 0); FirstPersonController myPlayerController = myPlayer.GetComponent <FirstPersonController>(); myPlayerController.enabled = true; myPlayerController.GetComponentInChildren <Camera>().enabled = true; myPlayerController.GetComponentInChildren <AudioListener>().enabled = true; standbyCamera.enabled = false; standbyCamera.GetComponent <AudioListener>().enabled = false; }
// Use this for initialization void Start() { hint = false; player = GameObject.FindGameObjectWithTag("Player").GetComponent <FirstPersonController> (); // as FirstPersonController; playerShoot = player.GetComponentInChildren <RaycastShoot> (); BeginTutorial0(); }
// Start is called before the first frame update void Start() { fpsController = GetComponentInParent <FirstPersonController>(); zoomLens = fpsController.GetComponentInChildren <Camera>(); defaultZoom = zoomLens.fieldOfView; zoomedIn = defaultZoom * zoomAdjustment; defaultSensitivity = fpsController.m_MouseLook.XSensitivity; setSensitivity = defaultSensitivity / Sensitivityadjustment; }
public void Resume() { gameIsPaused = false; pauseMenuUI.SetActive(false); Time.timeScale = 1f; //firstPersonController.GetComponentInChildren<MouseLook>().enabled = true; firstPersonController.GetComponent <FirstPersonController>().enabled = true; firstPersonController.GetComponentInChildren <DoorDetectionLite>().CrosshairPrefabInstance.SetActive(true); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
// Use this for initialization void Start () { // PowerUpSpawner.PowerUpCollected += powerUpCollected; weapons = GetComponentsInChildren<WeaponComponent>(); DisableAllWeapons(); player = transform.parent.gameObject.GetComponent<FirstPersonController>(); weaponsBar = player.GetComponentInChildren<SpecialWeaponsBar>(); weaponsBar.SetShots (0); ChangeWeapon(startPrimaryWeapon); ChangeWeapon(startSecondaryWeapon, 5); }
// Use this for initialization void Start() { // PowerUpSpawner.PowerUpCollected += powerUpCollected; weapons = GetComponentsInChildren <WeaponComponent>(); DisableAllWeapons(); player = transform.parent.gameObject.GetComponent <FirstPersonController>(); weaponsBar = player.GetComponentInChildren <SpecialWeaponsBar>(); weaponsBar.SetShots(0); ChangeWeapon(startPrimaryWeapon); ChangeWeapon(startSecondaryWeapon, 5); }
// Use this for initialization void Start() { if (meshFilter == null) { meshFilter = GetComponent <MeshFilter>(); meshFilter.gameObject.GetComponent <MeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; } if (vertices == null) { vertices = meshFilter.mesh.vertices; } // If perlin shifts are not specified, specify them. if (xSpeed == 0) { xSpeed = Random.Range(.001f, .023f); xSpeed *= (Random.Range(1, 3) * 2 - 3); } if (ySpeed == 0) { ySpeed = Random.Range(.1f, 1f); } if (zSpeed == 0) { zSpeed = Random.Range(.001f, .023f); zSpeed *= (Random.Range(1, 3) * 2 - 3); } // Calculate the relative y position of the camera if (fpsController != null) { WaterCamera = fpsController.GetComponentInChildren <Camera>(); } // Reference to the water plane's Material material = GetComponent <Renderer>().material; // Ensure the planeWidth(x) and planeLength(z) are valid. RecalculateSize(); RecalculateMinMaxVerts(); }
// ----------------------------------------- // During one Playthrough //------------------------------------------ /// <summary> /// This method is called whenever unity finished loading a scene or we manually move onto a new /// scene to update the state of the experiment. /// </summary> /// <param name="scene">Upcoming scene</param> /// <param name="mode">Unity parameter needed to mach listener.</param> private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!_initialized) { _initialized = true; return; } var isReplay = FirstPersonController.GetComponentInChildren <ReplayRoute>().isActivated(); var sceneList = ExperimentSettings.SceneSettings.Scenes; _activeSceneName = SceneManager.GetActiveScene().name; var subSceneName = sceneList[_currentScene].Name; Debug.Log("Scene " + _currentScene + ":" + subSceneName + " in " + _activeSceneName); if (!isReplay) { LoggingManager.InsertLiveSystemEvent("SceneFlow", "switch", null, "Scene " + _currentScene + ":" + subSceneName.Substring(0, Math.Min(subSceneName.Length, 25)) + " in " + _activeSceneName.Substring(0, Math.Min(_activeSceneName.Length, 25))); } FirstPersonController.transform.position = Vector3.zero; FirstPersonController.transform.rotation = Quaternion.identity; FirstPersonController.SetActive(false); if (_activeSceneName == "Launcher" && !_inQuestionnaire && !_configureLabchart) { //coming back from a scene Cursor.lockState = CursorLockMode.None; Cursor.visible = true; if (isReplay) { MenuManager.InstantiateAndShowMenu("Participant Menu", "Launcher"); } else { LoggingManager.LogSceneEnd(subSceneName); if (_currentScene < sceneList.Count - 1) { _currentScene++; LoadCurrentScene(); return; } else { MenuManager.InstantiateAndShowMenu("Finish Menu", "Launcher"); SessionParameters.Clear(); return; } } } //Reset state machine flags for a clean load _inQuestionnaire = false; _configureLabchart = false; //A new scene started that is not the if (!isReplay) { LoggingManager.LogSceneStart(subSceneName); } }