SHARE
TWEET

Untitled

a guest Dec 2nd, 2017 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine.EventSystems;
  5.  
  6. public class showCursorTest : MonoBehaviour {
  7.     public GameObject currentPlayer;
  8.     public bool showingCursor;
  9.     Camera mainCamera;
  10.     menuPause menuPauseManager;
  11.     playerController currentPlayerControllerManager;
  12.     inputManager input;
  13.  
  14.     void Start () {
  15.         menuPauseManager = FindObjectOfType<menuPause> ();
  16.         input = FindObjectOfType<inputManager> ();
  17.         setCurrentPlayer ();
  18.  
  19.     }
  20.  
  21.     void Update (){
  22.         if (input.checkInputButton ("Look At Target", inputManager.buttonType.getKeyDown)) {
  23.             changeCursorState (!showingCursor);
  24.         }
  25.     }
  26.        
  27.     public void changeCursorState (bool state)
  28.     {
  29.         showingCursor = state;
  30.         mainCamera.GetComponent<headBob> ().enabled = !showingCursor;
  31.         FindObjectOfType<mouseCursorController> ().showOrHideCursor (showingCursor);
  32.         if (showingCursor) {
  33.             if (currentPlayer.GetComponent<otherPowers> ().running) {
  34.                 currentPlayer.GetComponent<otherPowers> ().stopRun ();
  35.             }
  36.             menuPauseManager.usingDeviceState (showingCursor);
  37.             currentPlayerControllerManager.changeScriptState (!showingCursor);
  38.             menuPauseManager.showOrHideCursor (showingCursor);
  39.             menuPauseManager.changeCameraState (!showingCursor);
  40.         } else {
  41.             menuPauseManager.usingDeviceState (showingCursor);
  42.             currentPlayerControllerManager.changeScriptState (!showingCursor);
  43.             menuPauseManager.showOrHideCursor (showingCursor);
  44.             menuPauseManager.changeCameraState (!showingCursor);
  45.         }
  46.     }
  47.  
  48.     public void setCurrentPlayer(){
  49.         currentPlayerControllerManager = currentPlayer.GetComponent<playerController> ();
  50.         mainCamera = currentPlayerControllerManager.playerCameraGameObject.GetComponent<playerCamera>().getMainCamera();
  51.     }
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top