Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.EventSystems;
- public class showCursorTest : MonoBehaviour {
- public GameObject currentPlayer;
- public bool showingCursor;
- Camera mainCamera;
- menuPause menuPauseManager;
- playerController currentPlayerControllerManager;
- inputManager input;
- void Start () {
- menuPauseManager = FindObjectOfType<menuPause> ();
- input = FindObjectOfType<inputManager> ();
- setCurrentPlayer ();
- }
- void Update (){
- if (input.checkInputButton ("Look At Target", inputManager.buttonType.getKeyDown)) {
- changeCursorState (!showingCursor);
- }
- }
- public void changeCursorState (bool state)
- {
- showingCursor = state;
- mainCamera.GetComponent<headBob> ().enabled = !showingCursor;
- FindObjectOfType<mouseCursorController> ().showOrHideCursor (showingCursor);
- if (showingCursor) {
- if (currentPlayer.GetComponent<otherPowers> ().running) {
- currentPlayer.GetComponent<otherPowers> ().stopRun ();
- }
- menuPauseManager.usingDeviceState (showingCursor);
- currentPlayerControllerManager.changeScriptState (!showingCursor);
- menuPauseManager.showOrHideCursor (showingCursor);
- menuPauseManager.changeCameraState (!showingCursor);
- } else {
- menuPauseManager.usingDeviceState (showingCursor);
- currentPlayerControllerManager.changeScriptState (!showingCursor);
- menuPauseManager.showOrHideCursor (showingCursor);
- menuPauseManager.changeCameraState (!showingCursor);
- }
- }
- public void setCurrentPlayer(){
- currentPlayerControllerManager = currentPlayer.GetComponent<playerController> ();
- mainCamera = currentPlayerControllerManager.playerCameraGameObject.GetComponent<playerCamera>().getMainCamera();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement