// Update is called once per frame void Update() { healthBar.value = playerHealth.GetHealth() / playerHealth.GetMaxHealth(); healthText.text = Mathf.Round(playerHealth.GetHealth()).ToString(); manaBar.value = playerMana.getManaAmount() / playerMana.getMaxManaAmount(); manaText.text = Mathf.Round(playerMana.getManaAmount()).ToString(); itemSprite.sprite = itemManager.currentyEquipped().getScripatbleObject().sprite; }
// Update is called once per frame void Update() { RaycastHit hit; Ray mouseRay = main.ScreenPointToRay(Input.mousePosition); float enter; //For plane casting if (raycastPlane.Raycast(mouseRay, out enter)) { Vector3 hitPoint = mouseRay.GetPoint(enter); movement.LookPosition(new Vector3(hitPoint.x, transform.position.y, hitPoint.z)); } //For raycasting /*if (Physics.Raycast(mouseRay, out hit, 100f, mask)) { * Debug.Log("Collided with " + hit.transform.name + " at position " + hit.point); * movement.LookPosition(new Vector3(hit.point.x, transform.position.y, hit.point.z)); * mousePosition.transform.position = hit.point; * }*/ if (allowMovement) { if (Input.GetMouseButtonDown(0)) { itemManager.currentyEquipped().Use(); } if (Input.GetAxis("Mouse ScrollWheel") > 0f) { itemManager.EnableEquippableUp(); } else if (Input.GetAxis("Mouse ScrollWheel") < 0f) { itemManager.EnableEquippableDown(); } } if (Input.GetKeyDown(KeyCode.F) && canInteract) { allowMovement = !allowMovement; if (!allowMovement) { startInteraction.Raise(transform.position); } } if (Input.GetKeyDown(KeyCode.I)) { inventoryVisual.gameObject.SetActive(!inventoryVisual.gameObject.activeSelf); } }