/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void OnEnable() { //-------------- Vector3 thisPosition = thisTransform.position; currentStateTransform.rotation = Random.rotation; //-------------- getIntSeedGeneration = PlayerPrefs.GetInt(Class_MenuController.MenuSeed(thisPosition).ToString(), 0); if (getIntSeedGeneration == 0) { stateFriendly.transform.localScale = Vector3.one * 0.15f; stateEnemy.transform.localScale = Vector3.one * 0.15f; stateFriendly.SetActive(true); stateEnemy.SetActive(true); } else if (getIntSeedGeneration == 1) { stateFriendly.transform.localScale = Vector3.one * 0.2f; stateFriendly.SetActive(true); stateEnemy.SetActive(false); } else if (getIntSeedGeneration == 2) { stateEnemy.transform.localScale = Vector3.one * 0.2f; stateFriendly.SetActive(false); stateEnemy.SetActive(true); } selected.SetActive(false); //-------------- float seedAbsCos = Mathf.Abs(Mathf.Cos(Class_MenuController.MenuSeed(thisPosition))); if (Class_MenuController.MenuSeed(thisPosition) % 7 == 0) { sun.SetActive(false); blackHole.SetActive(true); blackHole.transform.localScale = Vector3.one * (seedAbsCos + 0.35f) * 2.5f; } else { blackHole.SetActive(false); sun.SetActive(true); Class_AdditionalTools.UvMesh(sun.GetComponent <MeshFilter>().mesh, seedAbsCos, 0.5f); sun.transform.localScale = Vector3.one * (seedAbsCos + 0.35f); } //-------------- }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void OnTriggerEnter(Collider other) { //-------------- if (other.gameObject.layer == 29 && Class_Interface.menuControlLock == false) { planetPosition = other.gameObject.transform.position; if (PlayerPrefs.GetInt(Class_MenuController.MenuSeed(planetPosition).ToString(), 0) == 0) { systemSelection = true; } } //-------------- }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void LateUpdate() { //-------------- if (Class_Interface.menuControlLock == false) { Vector2 axisNormalized = new Vector2(Input.GetAxis("Vertical"), Input.GetAxis("Horizontal")).normalized; directionForwardBack = Mathf.SmoothDamp(directionForwardBack, axisNormalized.x, ref verticalVelocity, 0.15f); directionLeftRight = Mathf.SmoothDamp(directionLeftRight, axisNormalized.y, ref horizontalVelocity, 0.15f); mouseX = Input.GetAxis("Mouse X") * 0.1f * PlayerPrefs.GetFloat("mouseSensitivityValue"); mouseX = Mathf.Clamp(mouseX, -18.0f, 18.0f); mouseXSmooth = Mathf.SmoothDamp(mouseXSmooth, mouseX, ref mouseXVelocity, 0.15f); thisTransform.Rotate(0, mouseXSmooth, 0); cameraRig.rotation = thisTransform.rotation; if (downLimiter == false && topLimiter == false) { mouseY = Input.GetAxis("Mouse Y") * 0.13f * PlayerPrefs.GetFloat("mouseSensitivityValue"); mouseY = Mathf.Clamp(mouseY, -50.0f, 50.0f); mouseYSmooth = Mathf.SmoothDamp(mouseYSmooth, mouseY, ref mouseYVelocity, 0.1f); thisTransform.Translate(-Vector3.up * mouseYSmooth); if (thisTransform.position.y < 45) { downLimiter = true; } if (thisTransform.position.y > 380) { topLimiter = true; } } if (downLimiter == true) { thisTransform.Translate(Vector3.up * 0.25f); if (counter0++ > 25) { counter0 = 0; downLimiter = false; } } if (topLimiter == true) { thisTransform.Translate(-Vector3.up * 1.5f); if (counter1++ > 25) { counter1 = 0; topLimiter = false; } } cameraRig.position = thisTransform.position; if (Input.GetMouseButtonDown(0)) { if (systemSelection == true) { PlayerPrefs.SetInt("SeedGen", Class_MenuController.MenuSeed(planetPosition)); SceneManager.LoadScene("main"); } } } //-------------- Class_Controller.playerPosition = thisTransform.position; //-------------- }