// Use this for initialization void Start() { _statusCursor = StatusCursor.GetComponent <LockCursor>(); try { _datePosition.xSign = this.gameObject.transform.position.x / Mathf.Abs(this.gameObject.transform.position.x); } catch { _datePosition.xSign = 0; } _datePosition.xMax = this.gameObject.transform.position.x + (100 * _datePosition.xSign); try { _datePosition.ySign = this.gameObject.transform.position.y / Mathf.Abs(this.gameObject.transform.position.y); } catch { _datePosition.ySign = 0; } _datePosition.yMax = this.gameObject.transform.position.y + (100 * _datePosition.ySign); try { _datePosition.zSign = this.gameObject.transform.position.z / Mathf.Abs(this.gameObject.transform.position.z); } catch { _datePosition.zSign = 0; } _datePosition.zMax = this.gameObject.transform.position.z + (100 * _datePosition.zSign); }
public void OnPlayAgainButtonClicked() { Time.timeScale = 1.0f; LockCursor.Lock(); m_endGameScreen.SetActive(false); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
void Awake() { //setup = GetComponent<Player_Setup>(); cursorLock = GameObject.Find("NetworkManager").GetComponent<LockCursor>(); manager = GetComponent<GM_Manager>(); overlay = GameObject.Find("Pause Overlay"); FindButtonContainer(); Pause(false); }
void Awake() { //setup = GetComponent<Player_Setup>(); cursorLock = GameObject.Find("NetworkManager").GetComponent <LockCursor>(); manager = GetComponent <GM_Manager>(); overlay = GameObject.Find("Pause Overlay"); FindButtonContainer(); Pause(false); }
public void OnEndGame() { if (m_endGameScreen != null) { Time.timeScale = 0.0f; LockCursor.Unlock(); m_endGameScreen.SetActive(true); } }
// Start is called before the first frame update void Start() { //MyObj = this.gameObject; audioSource = gameObject.AddComponent <AudioSource>(); Player = GameObject.Find("MotionPlayer"); playerconroller = Player.GetComponent <PlayerController>(); mousemanager = GameObject.Find("MouseManager"); lockcursor = mousemanager.GetComponent <LockCursor>(); }
// Use this for initialization void Start() { _statusCursor = StatusCursor.GetComponent <LockCursor>(); Rigidbody body = GetComponent <Rigidbody>(); if (body != null) { body.freezeRotation = true; } }
// Use this for initialization void Start() { _statusCursor = StatusCursor.GetComponent <LockCursor>(); _indexCamer = 0; foreach (Camera s in _arrayCameras) { s.gameObject.SetActive(false); } _arrayCameras [_indexCamer].gameObject.SetActive(true); }
// Start is called before the first frame update void Start() { //goalflag = false; Player = GameObject.Find("MotionPlayer"); playerconroller = Player.GetComponent <PlayerController>(); if (Spider) { spidercontroller = Spider.GetComponent <SpiderController>(); } mousemanager = GameObject.Find("MouseManager"); lockcursor = mousemanager.GetComponent <LockCursor>(); }
// Update is called once per frame void Update() { LockCursor lockcursor = GameObject.FindWithTag("GameController").GetComponent <LockCursor>(); bool keyboardEnabled = lockcursor.keyboardEnabled; if (keyboardEnabled) { Component cmp = GameObject.FindWithTag("percent").GetComponent("GUIText"); Vision vision = GameObject.FindWithTag("MainCamera").GetComponent <Vision> (); float boxNo = vision.boxNo; float collideNo = vision.collideNo; float percent = Mathf.FloorToInt((collideNo / boxNo) * 100); (cmp as GUIText).text = "Percent: " + percent + "%"; //Debug.Log ("boxNo" + boxNo); //Debug.Log ("collideNo" + collideNo); //Debug.Log ("percent" + percent); } }
public override Pose Calculate() { Col.Calculate(); Sens.Calculate(); Damp.Calculate(); LockCursor.Calculate(); PitchMax.Calculate(); PitchMin.Calculate(); Offset.Calculate(); OffsetUp.Calculate(); OffsetDown.Calculate(); Prev.Calculate(); if (controller != null && controller.executor != null) { float yaw = GetFloat("Yaw"); float pitch = GetFloat("Pitch"); float yawWanted = GetFloat("YawWanted"); float pitchWanted = GetFloat("PitchWanted"); Vector3 defaultPos = CameraController.GetGlobalVar("Default Anchor").value_v; Transform anchor = CameraController.GetTransform("Anchor"); Transform character = CameraController.GetTransform("Character"); Transform neck_m = CameraController.GetTransform("Bone Neck M"); Transform neck_r = CameraController.GetTransform("Bone Neck R"); bool isRagdoll = GetBool("Is Ragdoll"); float sens = Sens.value.value_f; bool rotButton = InputModule.Axis("Mouse Right Button").value_b; float mouseX = InputModule.Axis("Mouse X").value_f; float mouseY = InputModule.Axis("Mouse Y").value_f; float JoystickX = SystemSettingData.Instance.UseController ? InControl.InputManager.ActiveDevice.RightStickX * 25f * Time.deltaTime : 0f; float JoystickY = SystemSettingData.Instance.UseController ? InControl.InputManager.ActiveDevice.RightStickY * 12f * Time.deltaTime : 0f; bool inverseX = GetBool("Inverse X"); bool inverseY = GetBool("Inverse Y"); float pitchMax = PitchMax.value.value_f; float pitchMin = PitchMin.value.value_f; float damp = Mathf.Clamp(Damp.value.value_f, 0.005f, 1f); //float dt = Mathf.Clamp(Time.deltaTime, 0.001f, 0.1f); // Calc target Vector3 target = Vector3.zero; if (character != null) { if (neck_m != null && neck_r != null) { target = Vector3.Lerp(character.position, (isRagdoll ? neck_r : neck_m).position, 0.4f); } else { target = character.position; } } else if (anchor != null) { target = anchor.position; } else { target = defaultPos; } // rotate / zoom float dx = 0, dy = 0; if (Prev.value.lockCursor || rotButton) { dx = Mathf.Clamp(mouseX * sens * (inverseX ? -1f : 1f), -200, 200) * Time.timeScale; dy = Mathf.Clamp(mouseY * sens * (inverseY ? -1f : 1f), -200, 200) * Time.timeScale; } //float mdx = 0, mdy = 0; float jdx = 0, jdy = 0; //mdx = dx; //mdy = dy; jdx = JoystickX * sens * (inverseX ? -1f : 1f) * Time.timeScale; jdy = JoystickY * sens * (inverseY ? -1f : 1f) * Time.timeScale; dx += jdx; dy += jdy; dx = Mathf.Clamp(dx, -6 * sens, 6 * sens); dy = Mathf.Clamp(dy, -3 * sens, 3 * sens); yawWanted += dx; pitchWanted += dy; yawWanted = Mathf.Repeat(yawWanted, 360f); pitchWanted = Mathf.Clamp(pitchWanted, pitchMin, pitchMax); yaw = Mathf.LerpAngle(yaw, yawWanted, damp); pitch = Mathf.LerpAngle(pitch, pitchWanted, damp); Pose pose = Prev.value; pose.eulerAngles = new Vector3(-pitch, yaw, 0); Vector3 forward = pose.rotation * Vector3.forward; Vector3 right = pose.rotation * Vector3.right; Vector3 up = pose.rotation * Vector3.up; Vector3 lofs = Vector3.zero; if (pitch < 0) { lofs = Vector3.Slerp(Offset.value.value_v, OffsetDown.value.value_v, pitch / pitchMin); } else { lofs = Vector3.Slerp(Offset.value.value_v, OffsetUp.value.value_v, pitch / pitchMax); } Vector3 ofs = lofs.x * right + lofs.y * up + lofs.z * forward; float aspect = controller.executor.camera.aspect; float ur = Mathf.Sqrt(1f + aspect * aspect) * Mathf.Tan(pose.fov * 0.5f * Mathf.Deg2Rad); LayerMask layermask = controller.executor.GetVar("Obstacle LayerMask").value_i; float NCR = Utils.EvaluateNearclipPlaneRadius(target, 0.05f, pose.nearClip * ur, layermask); pose.nearClip = NCR / ur; RaycastHit rch; if (Physics.SphereCast(new Ray(target, ofs.normalized), NCR - 0.01f, out rch, ofs.magnitude, layermask, QueryTriggerInteraction.Ignore)) { ofs = ofs.normalized * rch.distance; } pose.position = target + ofs; pose.lockCursor = LockCursor.value.value_b; controller.executor.SetFloat("Yaw", yaw); controller.executor.SetFloat("Pitch", pitch); controller.executor.SetFloat("YawWanted", yawWanted); controller.executor.SetFloat("PitchWanted", pitchWanted); return(pose); } return(Pose.Default); }
public void OnResumeButtonClicked() { Time.timeScale = 1.0f; LockCursor.Lock(); m_pauseScreen.SetActive(false); }
public void OnPauseGame() { Time.timeScale = 0.0f; LockCursor.Unlock(); m_pauseScreen.SetActive(true); }