void Start() { positionCrosshair = new Rect((Screen.width - crossHair.width) / 2, (Screen.height - crossHair.height) / 2, crossHair.width, crossHair.height); bulletPrefab.GetComponent <Rigidbody>(); ammoPistol = spawnCountAmmoPistol; ammoRifle = spawnCountAmmoRifle; currentGun = CurrentWeapon.pistol; polKursor = menuAlive.game; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
/// <summary> /// Standart method in Unity, launched at the start of the script /// </summary> void Start() { _animator = GetComponent <Animator>(); positionCrosshair = new Rect((Screen.width - crossHair.width) / 2, (Screen.height - crossHair.height) / 2, crossHair.width, crossHair.height); polKursor = menuAlive.game; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; if (listGun.Length != 0) { currentGun = listGun[0]; listGun[0].SetActive(true); listGun[1].SetActive(false); } }
public void activeSettings() { if (Input.GetKeyDown(KeyCode.Escape) && polKursor == menuAlive.game) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; gameObject.GetComponent <MouseLook>().enabled = false; gameObject.GetComponent <FPSInput>().enabled = false; mainCamera.GetComponent <MouseLook>().enabled = false; polKursor = menuAlive.setting; } else if (Input.GetKeyDown(KeyCode.Escape) && polKursor == menuAlive.setting) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; gameObject.GetComponent <MouseLook>().enabled = true; gameObject.GetComponent <FPSInput>().enabled = true; mainCamera.GetComponent <MouseLook>().enabled = true; polKursor = menuAlive.game; } }