// Use this for initialization void Start() { Cursor.lockState = CursorLockMode.Locked; pc = character.GetComponent <PlayerController>(); cml = character.GetComponentInChildren <CamMouseLook>(); destroyQuestScreen = GameObject.Find("QuestCompletedScreen").GetComponent <destroyQuestScreen>(); }
// Use this for initialization void Start() { if (gameManager == null) { gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); } pc = gameManager.character.GetComponent <PlayerController>(); cml = gameManager.character.GetComponentInChildren <CamMouseLook>(); }
private void Start() { character = GameObject.Find("Character"); MenuSystem = this.transform.parent.gameObject; if (character != null) { pc = character.GetComponent <PlayerController>(); cml = character.GetComponentInChildren <CamMouseLook>(); } }
// Use this for initialization void Start() { //get some components & objects player = GameObject.Find("Character"); vitals = player.GetComponent <Vitals>(); camMouseLook = player.transform.Find("FPPCamera").GetComponent <CamMouseLook>(); vitals.setBladderState(true); //set the initial position to the player position transform.position = player.transform.position; }
// Start is called before the first frame update void Start() { cameraVars = GameObject.Find("Camera").GetComponent <CamMouseLook>(); playerTools = GameObject.Find("Player").GetComponent <Weapons>(); rb = this.gameObject.GetComponent <Rigidbody>(); line = GameObject.Find("Arms").GetComponent <LineRenderer>(); upLift = -Physics.gravity * (2 - rb.velocity.y * 5); line.SetPosition(0, Vector3.zero); Physics.Raycast(GameObject.Find("Camera").transform.position, GameObject.Find("Camera").transform.forward, out staticHit, Mathf.Infinity); }
void Start() { if (SceneManager.GetActiveScene().name != "MainMenu") { currSens = GameObject.Find("Player").transform.Find("Main Camera").GetComponent <CamMouseLook>(); GameObject.Find("Sensitivity Slider").GetComponent <Slider>().value = PlayerPrefs.GetFloat("sensitivity"); } resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currResIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " X " + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currResIndex = i; } } if (PlayerPrefs.GetInt("isFS") == 1) { GameObject.Find("Fullscreen Toggle").GetComponent <Toggle>().isOn = true; Screen.fullScreen = true; } else if (PlayerPrefs.GetInt("isFS") == -1) { GameObject.Find("Fullscreen Toggle").GetComponent <Toggle>().isOn = false; Screen.fullScreen = false; } resolutionDropdown.AddOptions(options); if (PlayerPrefs.GetInt("resIndex") == 0) { resolutionDropdown.value = currResIndex; } else { resolutionDropdown.value = PlayerPrefs.GetInt("resIndex"); } resolutionDropdown.RefreshShownValue(); GameObject.Find("Volume Slider").GetComponent <Slider>().value = PlayerPrefs.GetFloat("volume"); }
/// <summary> /// Toggles movement, returns true/false if enabled/disabled /// </summary> /// <returns></returns> public static bool ToggleMovement() { Disable(isDisabled); CamMouseLook.SetRotation(isDisabled); if (!isDisabled) { Cursor.lockState = CursorLockMode.Locked; } else { Cursor.lockState = CursorLockMode.None; } return(isDisabled); }
/// <summary> /// Enabled = true, disabled = false /// </summary> /// <param name="movement">Set movement enabled</param> /// <param name="rotation">Set rotation enabled</param> /// <returns></returns> public static bool SetMovement(bool movement, bool rotation) { if (isDisabled != movement) { Disable(!movement); } if (CamMouseLook.GetEnabled != rotation) { CamMouseLook.SetRotation(!rotation); } // If it worked, return true if (isDisabled == !movement && CamMouseLook.GetEnabled == rotation) { return(true); } return(false); }
private PhysicsRestrictions selfRestrictions; // Get self restrictions // Start is called before the first frame update void Start() { thePlayer = GameObject.Find("Player").GetComponent <CharController>(); playerTools = GameObject.Find("Player").GetComponent <Weapons>(); cameraVars = GameObject.Find("Camera").GetComponent <CamMouseLook>(); selfRestrictions = this.gameObject.GetComponent <PhysicsRestrictions>(); if (gameObject.GetComponent <Rigidbody>() != null) { objRb = gameObject.GetComponent <Rigidbody>(); buoyancyLift = -Physics.gravity * (2 - objRb.velocity.y * 5); } else { selfRestrictions.allowDragging = false; } }
// Start is called before the first frame update void Start() { thePlayer = GameObject.Find("Player").GetComponent <CharController>(); cameraVars = GameObject.Find("Camera").GetComponent <CamMouseLook>(); weaponTextPrev = GameObject.Find("WeaponPrev").GetComponent <Text>(); weaponTextMain = GameObject.Find("WeaponMain").GetComponent <Text>(); weaponTextNext = GameObject.Find("WeaponNext").GetComponent <Text>(); weaponButtons = GameObject.Find("Canvas").GetComponent <ToggleUI>(); selectedWeapon = GameObject.Find("Weapon").GetComponent <Text>(); selectedWeaponFunction = GameObject.Find("Function").GetComponent <Text>(); destConfigJoint = cameraVars.gameObject.transform.Find("Destination").GetComponent <ConfigurableJoint>(); ToolDescriptor(); SetWeaponStatus(); }
//private SpawnObjects spawningObj; // Start is called before the first frame update void Start() { cameraVars = GameObject.Find("Camera").GetComponent <CamMouseLook>(); playerTools = GameObject.Find("Player").GetComponent <Weapons>(); //spawningObj = GameObject.Find("SpawnSelect").GetComponent<SpawnObjects>(); speedCopy = speed; sprintCopy = sprint; crouchCopy = crouch; rb = this.gameObject.GetComponent <Rigidbody>(); line = GameObject.Find("Pistol").GetComponent <LineRenderer>(); upLift = -Physics.gravity * (2 - rb.velocity.y * 5); line.SetPosition(0, Vector3.zero); Physics.Raycast(GameObject.Find("Camera").transform.position, GameObject.Find("Camera").transform.forward, out staticHit, Mathf.Infinity); }
// Use this for initialization public void Start() { player = GameObject.Find("Character"); //gets a reference to the vitals class vitals = player.GetComponent <Vitals>(); vitals.setKnockedOutState(true); Debug.Log("You've been knocked out..."); knockedOutFinished = false; fadeTop = transform.Find("fadeTop").gameObject; fadeBottom = transform.Find("fadeBottom").gameObject; print("The current mode is " + CurrentMode); //slightly rotates the player's z angle so that they can fall over //player.transform.rotation = Quaternion.Euler(player.transform.eulerAngles.x, player.transform.eulerAngles.y, -10.0f); //disbales the player controller script playerController = player.GetComponent <PlayerController>(); playerController.enabled = false; //gets the FPPCamera and then disables the Cam Mouse Look script CamMouseLook = player.transform.Find("FPPCamera").GetComponent <CamMouseLook>(); CamMouseLook.enabled = false; //unlocks the Z axis so that the player can fall over player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY; //Random force applied to the body provides a more natural fall. Vector3 forceLocation = Random.onUnitSphere * 20; player.GetComponent <Rigidbody>().AddForce(forceLocation, ForceMode.Impulse); audioSource = GetComponent <AudioSource>(); }
// Use this for initialization void Awake() { if (gameManager == null) { gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); } if (questHandler == null) { questHandler = GameObject.Find("GameManager").GetComponent <QuestHandler>(); } if (QuestScreen == null) { QuestScreen = GameObject.Find("QuestCompletedScreen"); } childrenIndex = transform.childCount; //sets the color for each quad of the children for (int i = 0; i < childrenIndex; i++) { if (transform.GetChild(i).childCount != 0) { Transform child = transform.GetChild(i).GetChild(0); if (child != null) { if (child.name == "Quad") { Renderer rend = child.GetComponent <Renderer>(); rend.material.color = questColor; rend.material.SetColor("_EmissionColor", questColor); } } } } pc = gameManager.character.GetComponent <PlayerController>(); cml = gameManager.character.GetComponentInChildren <CamMouseLook>(); }
// Start is called before the first frame update void Start() { cameraVars = GameObject.Find("Camera").GetComponent <CamMouseLook>(); thePlayer = GameObject.Find("Player").GetComponent <CharController>(); sounds = GameObject.Find("Camera").GetComponent <PlayerSounds>(); slomoFade = GameObject.Find("SlomoEffect").GetComponent <UIFade>(); buttons = GameObject.Find("buttons"); crosshair = GameObject.Find("crosshair"); spawnSelection = GameObject.Find("Q-Menu"); //customKeys = GameObject.Find("CustomKeys").transform; DefaultUIState(); /*for(int i = 0; i < customKeys.childCount; i++){ * if(customKeys.GetChild(i).name == "forwardKeyButton"){ * customKeys.GetChild(i).GetComponentInChildren<Text>().text = "UpArrow"; * }else if(customKeys.GetChild(i).name == "backwardKeyButton"){ * customKeys.GetChild(i).GetComponentInChildren<Text>().text = "DownArrow"; * } * }*/ }
void Awake() { playerLookScript = PlayerCamera.GetComponent <CamMouseLook>(); }
// Start is called before the first frame update void Start() { cam = GetComponent <Camera>(); look = GetComponent <CamMouseLook>(); }