// Start is called before the first frame update void Start() { audioSource = GetComponent <AudioSource>(); nightmareController = GameObject.Find("NightmareController").GetComponent <NightmareController>(); shakeObjectOnTrigger = GameObject.Find("Player/EnemyDetector").GetComponent <ShakeObjectOnTrigger>(); nextVolume = 0.0f; }
// Start is called before the first frame update void Start() { // Remember where we started to apply changes and respawn spawnPoint = transform.position; spawnRotation = transform.rotation; // Grab references of gameObject components as needed. rb = GetComponent <Rigidbody>(); myCamera = GetComponentInChildren <Camera>(); myCameraObject = myCamera.gameObject; coll = GetComponentInChildren <CapsuleCollider>(); shakeObjectOnTrigger = GetComponentInChildren <ShakeObjectOnTrigger>(); deathEffects = GetComponent <PlayerDeathEffects>(); // Setup initial conditions coll.height = standingHeight; originalCameraRotation = myCamera.transform.localRotation; myCameraObject.transform.localPosition = new Vector3(0, (coll.height / 2) - cameraOffsetFromHead, 0); rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; isGrounded = true; Cursor.lockState = cursorLockedMode; // Hide cursor when locking Cursor.visible = (CursorLockMode.Locked != cursorLockedMode); }