void Update() { if(!hasSetBiomeInfo) { gradiantValue = BiomeTypes.biomeGenerator.biomeTypeDict [(BiomeTypes.biomeType)biome].gradiant; defaultCube = BiomeTypes.biomeGenerator.biomeTypeDict [(BiomeTypes.biomeType)biome].defaultCube; defaultGrass = BiomeTypes.biomeGenerator.biomeTypeDict [(BiomeTypes.biomeType)biome].defaultGrass; defaultTree = BiomeTypes.biomeGenerator.biomeTypeDict [(BiomeTypes.biomeType)biome].defaultTree; hasSetBiomeInfo = true; } }
void UpdateActiveSlot() { indexOfSlot = moveToActive.index; activeSlot = InventoryManager.inventoryManager.activeInventorySlots [indexOfSlot]; activeItemID = activeSlot.itemID; if (activeItemID != 0) activeItemType = CubeProperties.cubeProperties.itemDict [activeItemID].itemType; }
// Update is called once per frame void Update() { itemID = slot.itemID; image.sprite = slot.image.sprite; text.text = slot.textObj.text; }
void Update() { if (OpenMenus.inMenu) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; return; } else { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } tempItemID = activeItemID; float rotLeftRight = Input.GetAxis ("Mouse X") * mouseSen; transform.Rotate (0, rotLeftRight, 0); verticalRotation -= Input.GetAxis ("Mouse Y") * mouseSen; verticalRotation = Mathf.Clamp (verticalRotation, -upDownRange, upDownRange); Camera.main.transform.localRotation = Quaternion.Euler (verticalRotation, 0, 0); if (Input.GetKeyDown (KeyCode.LeftShift)) { speed = sprintSpeed; } if (Input.GetKeyUp (KeyCode.LeftShift)) { speed = 5.0f; } if (Input.GetKey (KeyCode.W)) { transform.Translate (Vector3.forward * Time.deltaTime * speed); } if (Input.GetKey (KeyCode.S)) { transform.Translate (Vector3.back * Time.deltaTime * speed); } if (Input.GetKey (KeyCode.A)) { transform.Translate (Vector3.left * Time.deltaTime * speed); } if (Input.GetKey (KeyCode.D)) { transform.Translate (Vector3.right * Time.deltaTime * speed); } if (Input.GetKeyDown (KeyCode.Space) && grounded) { if (gameObject.GetComponent<Rigidbody> ().velocity.y < 5f) gameObject.GetComponent<Rigidbody> ().AddForce (Vector3.up * jumpForce); grounded = false; } UpdateActiveSlot (); if (Input.GetMouseButtonDown (1)) { CheckWhatWasHitRightClick(); } if (Input.GetMouseButtonDown (0)) { DestroyCubeFromMesh(); } RaycastHit hit; if (Physics.Raycast (myCamera.transform.position, myCamera.forward, out hit, blockPlaceRange)) { if (hit.collider.gameObject.tag == "World") { Vector3 pos = hit.point - hit.normal / 2; pos.x = Mathf.Floor (pos.x) + 0.5f; pos.y = Mathf.Floor (pos.y) + 0.5f; pos.z = Mathf.Floor (pos.z) + 0.5f; highlightFab.transform.position = pos; } } else { highlightFab.transform.position = Vector3.zero; } if (activeItemID != tempItemID) ShowActiveTool (); }