public void LookRotation(Transform character, Transform camera) { if (!MouseLock.isLocked()) { return; } float yRot = CrossPlatformInputManager.GetAxis("Mouse X") * XSensitivity; float xRot = CrossPlatformInputManager.GetAxis("Mouse Y") * YSensitivity; m_CharacterTargetRot *= Quaternion.Euler(0f, yRot, 0f); m_CameraTargetRot *= Quaternion.Euler(-xRot, 0f, 0f); if (clampVerticalRotation) { m_CameraTargetRot = ClampRotationAroundXAxis(m_CameraTargetRot); } if (smooth) { character.localRotation = Quaternion.Slerp(character.localRotation, m_CharacterTargetRot, smoothTime * Time.deltaTime); camera.localRotation = Quaternion.Slerp(camera.localRotation, m_CameraTargetRot, smoothTime * Time.deltaTime); } else { character.localRotation = m_CharacterTargetRot; camera.localRotation = m_CameraTargetRot; } }
void HandleCamera() { if (MouseLock.GetMouseLocked()) { sphericalVectorData.Azimuth += Input.GetAxis("Mouse X") * orbitSpeed.x; sphericalVectorData.Zenith += Input.GetAxis("Mouse Y") * orbitSpeed.y; } sphericalVectorData.Zenith = Mathf.Clamp(sphericalVectorData.Zenith + orbitOffset.x, orbitOffset.y, 0f); float distanceToObject = zoomValue; float deltaDistance = Mathf.Clamp(zoomValue, distanceToObject, -distanceToObject); sphericalVectorData.Length += (deltaDistance - sphericalVectorData.Length); Vector3 lookAt = targetOffset; lookAt += playerTarget.position; base.Update(); transform.position += lookAt; transform.LookAt(lookAt); if (zoomValue == cameraLengthZoom) { Quaternion targetRotation = transform.rotation; targetRotation.x = 0f; targetRotation.z = 0f; playerTarget.rotation = targetRotation; } cameraPosition = cameraPositionTemporary; zoomValue = cameraLength; }
void Start() { if (!itemText) { itemText = Resources.Load("Prefabs/Items/ItemText") as TextAsset; // json 파일 로드. } if (itemText) { itemScripts = JsonUtility.FromJson <ItemInfoArray>(itemText.ToString()); // 파싱. } // 직접 할당. if (player == null) { player = FirstPersonCamera.player; } if (mouse == null) { mouse = GameManager.gm.GetComponent <MouseLock>(); } if (eventSystem == null) { eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>(); } // Canvas에 기존으로 붙어있는 인스턴스를 사용한다. raycaster = GameObject.Find("Canvas").GetComponent <GraphicRaycaster>(); // 보통 이벤트 함수의 매개변수로 사용되기에 기타 외부 함수에서 쓰려면 특정 EventSystem을 걸어놓고 생성한다. pointerEventData = new PointerEventData(eventSystem); IsOpened = false; // 인벤토리가 처음 시작했을 때는 닫혀있으니까 false로 시작한다. BlueKey = false; Hint = false; }
// Update is called once per frame private void Update() { if (!MouseLock.isLocked()) { return; } RotateView(); // the jump state needs to read here to make sure it is not missed if (!m_Jump) { m_Jump = CrossPlatformInputManager.GetButtonDown("Jump"); } if (!m_PreviouslyGrounded && m_CharacterController.isGrounded) { StartCoroutine(m_JumpBob.DoBobCycle()); PlayLandingSound(); m_MoveDir.y = 0f; m_Jumping = false; } if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded) { m_MoveDir.y = 0f; } m_PreviouslyGrounded = m_CharacterController.isGrounded; }
void Start() { // 금고 캔버스 비활성화 safe_canvas.SetActive(false); // 플레이어 레이캐스트 가져오기 player = FirstPersonCamera.player; mouse = GameManager.gm.GetComponent <MouseLock>(); }
public void Hide() { if (_data.UnlockCursorOnShow) { MouseLock.TryLock(); /// locks down cursor on close } ClearStack(); OnHide.Invoke(); }
void Start() { player = FirstPersonCamera.player; mouse = GameManager.gm.GetComponent <MouseLock>(); pic = false; sound = false; }
public void Show() { if (_data.UnlockCursorOnShow) { MouseLock.TryUnlock(); /// frees up cursor on open } OpenMenu(_startMenu); OnShow.Invoke(); }
// Use this for initialization void Start() { player = FirstPersonCamera.player; SafeCamera = false; mouse = GameManager.gm.GetComponent <MouseLock>(); doorani = GameObject.Find("SafeDoor").GetComponent <Animator>(); dooranicheck = true; unlock = false; }
void HandleMouseLocking() { if (Input.GetKeyDown(KeyCode.Tab)) { if (MouseLock.GetMouseLocked()) { MouseLock.SetMouseLocked(false); } else { MouseLock.SetMouseLocked(true); } } }
public static MouseLock instance = null; // an MouseLock instance // Use this for initialization void Awake() { //判断是否已有一个实例 if (instance == null) { instance = this; //如果没有,那么设置实例为该实例 } else if (instance != this) { Destroy(gameObject); //保证只能有一个实例 } //设置为重新加载场景时不被销毁 DontDestroyOnLoad(gameObject); }
void Start() { playerTarget = GameObject.FindGameObjectWithTag("Player").transform; mainCamera = Camera.main; sphericalVectorData.Length = cameraLength; sphericalVectorData.Azimuth = angleOffset.x; sphericalVectorData.Zenith = angleOffset.y; cameraPositionTemporary = mainCamera.transform.localPosition; cameraPosition = cameraPositionTemporary; MouseLock.SetMouseLocked(true); }
void Start() { OnePanel = GameObject.Find("OnePanel"); TwoPanel = GameObject.Find("TwoPanel"); ThreePanel = GameObject.Find("ThreePanel"); FourPanel = GameObject.Find("FourPanel"); FivePanel = GameObject.Find("FivePanel"); SixPanel = GameObject.Find("SixPanel"); SevenPanel = GameObject.Find("SevenPanel"); EightPanel = GameObject.Find("EightPanel"); NinePanel = GameObject.Find("NinePanel"); TenPanel = GameObject.Find("TenPanel"); mouse = GameManager.gm.GetComponent <MouseLock>(); }
Quaternion rotation = Quaternion.Euler(0, 90, 0); //Knight에 회전값을 주기위함. private void Start() { Debug.Log("Board_Manager Start()"); sound = GetComponent <AudioSource>(); b_director = GameObject.Find("Ch6_BossRoom_TimeLine").GetComponent <Ch6_SceneChange>(); win = GameObject.Find("Ch6_BossRoom_TimeLine").GetComponent <Ch6_SceneChange>().time1; defeat = GameObject.Find("Ch6_BossRoom_TimeLine").GetComponent <Ch6_SceneChange>().time2; mouse = GameManager.gm.GetComponent <MouseLock>(); //Clear = 1; //다음스테이지로 가기위한변수 and 현재 스테이지를 나타내는 변수 //Number = 10; //횟수 //timer = 120.0f; //각 스테이지마다 주어지는 시간제한 //Instance = this; //this로 선언 시켜줘야 말을 선택할 수 있다. //Stage1(); //말들을 소환시키는 SpawnAllChessmans함수를 부른다. }
void Start() { player = Camera.main.transform.parent.GetComponent <FirstPersonCamera>(); BookCanvas1.SetActive(false); BookCanvas2.SetActive(false); BookCanvas3.SetActive(false); BeforButton.SetActive(false); NextButton.SetActive(false); Page1 = false; Page2 = false; Page3 = false; BookCheck = false; isOpened = false; mouse = GameManager.gm.GetComponent <MouseLock>(); gameObject.SetActive(false); }
public virtual bool SetupMouseLock() { bool continute_setup = true; AlertProgress("Checking MouseLock Dependencies"); MouseLock mouseLock = camera.GetComponent <MouseLock>(); if (mouseLock) { AlertProgress("MouseLock Found"); continute_setup = true; } else { AlertProgress("MouseLock not found"); AlertProgress("Creating MouseLock"); mouseLock = camera.AddComponent <MouseLock>(); continute_setup = true; } AlertProgress("MouseLock Setup complete"); return(continute_setup); }
void Start() { mouse = GameManager.gm.GetComponent <MouseLock>(); // Hierarchy에 있는 Pas1오브젝트를 (위에서 선언한)Pas1오브젝트에 담는다 // 이하 위 설명과 같음 Pas1 = GameObject.Find("Pas1"); Pas2 = GameObject.Find("Pas2"); Pas3 = GameObject.Find("Pas3"); Pas4 = GameObject.Find("Pas4"); // Hierarchy에 있는 OnePanel오브젝트를 (위에서 선언한)OnePanel오브젝트에 담는다 // 이하 위 설명과 같음 OnePanel = GameObject.Find("OnePanel"); TwoPanel = GameObject.Find("TwoPanel"); ThreePanel = GameObject.Find("ThreePanel"); FourPanel = GameObject.Find("FourPanel"); FivePanel = GameObject.Find("FivePanel"); SixPanel = GameObject.Find("SixPanel"); SevenPanel = GameObject.Find("SevenPanel"); EightPanel = GameObject.Find("EightPanel"); NinePanel = GameObject.Find("NinePanel"); ZeroPanel = GameObject.Find("ZeroPanel"); StarPanel = GameObject.Find("StarPanel"); ShapPanel = GameObject.Find("ShapPanel"); // 올바른 비밀번호를 확인하기 위한 bool 변수도 false 해준다. check1 = false; check2 = false; check3 = false; check4 = false; // '확인' 버튼을 false 한다. Okcheck = false; }
void Start() { mouse = GameManager.gm.GetComponent <MouseLock>(); }
// Use this for initialization void Start() { game = GetComponent<MouseLock>(); Reset (); }
void Start() { mouseLock = GetComponent <MouseLock>(); }
void Awake() { Instance = this; }
void Update() { if (Input.GetKeyDown(KeyCode.E)) { opened = !opened; } if (opened) { inventory.SetActive(true); } else { inventory.SetActive(false); } if (dropBox.childCount != 0) { int childs = dropBox.childCount; for (int i = 0; i < childs; i++) { dropItem(dropBox.GetChild(i).gameObject); usedSlots--; } } if (equipeBox.childCount != 0) { if (equipedObject == null) { equipedObject = equipeBox.GetChild(0).gameObject; equipedObjectParent = equipedObject.transform; print("LOL: " + equipedObject.GetComponent <Item> ().name); equipedObject.GetComponent <Item> ().equipeObject.transform.SetParent(gunHandler.transform); equipedObject.GetComponent <Item> ().equipeObject.SetActive(true); equipedObject.GetComponent <Item> ().equipeObject.transform.localPosition = new Vector3(0, 0, 0); equipedObject.GetComponent <Item> ().equipeObject.transform.localRotation = new Quaternion(0, 0, 0, 1); equipedObject.GetComponent <Item> ().equipeObject.transform.localScale = new Vector3(1, 1, 1); usedSlots--; } } else { if (equipedObject != null) { equipedObject.GetComponent <Item> ().equipeObject.transform.SetParent(equipedObjectParent); equipedObject.GetComponent <Item> ().equipeObject.SetActive(false); equipedObject = null; } } if (Input.GetKeyDown(KeyCode.E) && !opened) { MouseLock.setLocked(true); } if (player.GetComponent <Player> ().dead) { deathScreen.SetActive(true); for (int i = 0; i < slotsObject.Count; i++) { if (slotsObject [i].transform.childCount != 0) { Destroy(slotsObject [i].transform.GetChild(0).gameObject); } } usedSlots = 0; if (equipeBox.childCount != 0) { Destroy(equipeBox.GetChild(0).gameObject); Destroy(gunHandler.transform.GetChild(0).gameObject); equipeBox.GetComponent <ItemSlot>().isUsed = false; } } else { deathScreen.SetActive(false); } }