private void LateUpdate() { //This code orbits the camera during hide mode - Jak if (playerPosRef.IsHidden()) { CameraParent = this.gameObject.transform.parent; //At this point, the parent object is an invisible point at the ITEM position that we now rotate currentHorizontal = Camera.main.GetComponent <CamLock>().currentHorizontal; currentVertical = Camera.main.GetComponent <CamLock>().currentVertical; //Create rotation Quaternion rotation = Quaternion.Euler(currentVertical, currentHorizontal, 0); if (CameraParent != null) { target = CameraParent; this.CameraParent.rotation = rotation /*Quaternion.Lerp(this.CameraParent.rotation, rotation, Time.deltaTime * rotationDamping)*/; } } }
// Update is called once per frame void Update() { if (!isPaused) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } if (Input.GetKeyDown(KeyCode.Escape)) { if (!isStoryboardActive) { Pause(); } else { menuSkip(); } } if (menuSkipBool) { if (screenDimension != new Vector3(Screen.width / 2, Screen.height / 2)) { screenDimension = new Vector3(Screen.width / 2, Screen.height / 2); cursor.GetComponent <RectTransform>().position = new Vector3(screenDimension.x, screenDimension.y, cursor.GetComponent <RectTransform>().position.z); if (screenDimension.x > 900) { cursor.GetComponent <Text>().fontSize = 25; } else { cursor.GetComponent <Text>().fontSize = 50; } } } //timeLeft = timer; txt_npcCount.text = NPCcount.ToString(); //txt_playerHealth.text = player.health.ToString() + "%"; //Pause the game - kinda //if (Input.GetKey(KeyCode.Escape) && !win) //{ // Time.timeScale = 0; //slow the game to a hault // canvasPause.gameObject.SetActive(true); // Camera.main.GetComponent<CamLock>().enabled = false; // player.gameObject.GetComponent<playerCannonBall>().enabled = false; // player.gameObject.GetComponent<playerPossession>().enabled = false; // player.gameObject.GetComponent<AudioSource>().enabled = false; // player.gameObject.GetComponent<PlayerController>().enabled = false; // AgentController[] agents = GameObject.FindObjectsOfType<AgentController>(); // foreach (AgentController agent in agents) // agent.gameObject.GetComponent<script_ProtonBeam_v5>().enabled = false; // paused = true; //} //Winscreen if (NPCcount <= 0) { NPCcount = 0; // win = true; StoryboardOutro.gameObject.SetActive(true); Time.timeScale = 0; isPaused = true; Cursor.lockState = CursorLockMode.None; Cursor.visible = true; // player.gameObject.GetComponent<playerCannonBall>().enabled = false; // player.gameObject.GetComponent<playerPossession>().enabled = false; // player.gameObject.GetComponent<AudioSource>().enabled = false; gameObject.GetComponentInParent <CharacterController>().enabled = false; gameObject.GetComponentInParent <playerController>().enabled = false; // AgentController[] agents = GameObject.FindObjectsOfType<AgentController>(); // foreach (AgentController agent in agents) // agent.gameObject.GetComponent<script_ProtonBeam_v5>().enabled = false; } //else //{ // timeLeft = timer - Time.time; //Countdown the timer //} //Gameover State if (!player.IsHidden()) //Might cause core loop issues unsure yet, need this to prevent unreferenced error because i move the camera { if (player.GetComponent <playerController>().GetEctoplasm <= 0) { Time.timeScale = 1; if (player.IsPossessed()) { player.PossessedItem.GetComponent <playerPossession>().UnpossessItem(); } GameObject.FindGameObjectWithTag("Player").GetComponent <playerController>().GetEctoplasm = 100; GameObject.FindGameObjectWithTag("Player").transform.position = GameObject.Find("respawnPosition").transform.position; } } } //End update