private void PickItemFitToScreen() { var rt = UI_PickItem.GetComponent <RectTransform>(); var posx = Screen.width * 0.0f - (rt.sizeDelta.x * 0.0f); var posy = Screen.height * -0.5f + (rt.sizeDelta.y * 0.5f) + (Screen.height * 0.1f); rt.localPosition = new Vector3(posx, posy, 0); }
private void Start() { StartCoroutine(CheckPlayerDistance()); if (UI_PickItem.activeInHierarchy) { UI_PickItem.SetActive(false); } }
private void Update() { if (distanceFromPlayer < 0.6f && LevelUP.statusReference == null) { UI_PickItem.SetActive(true); isPlayerNearby = true; if (Input.GetButtonDown("Circle")) { PlayerControl.PotionManager.PickUpPotion(gameObject); isPlayerNearby = false; } } else { isPlayerNearby = false; UI_PickItem.SetActive(false); } }