// Update is called once per frame void LateUpdate() { if (unit == null) { if (thisObj.activeInHierarchy) { thisObj.SetActive(false); } return; } if (unit.hitPoint >= unit.hitPointFull) { if (image.enabled) { image.enabled = false; } } else { if (!image.enabled) { image.enabled = true; } } if (!thisObj.activeInHierarchy) { return; } Vector3 screenPos = Camera.main.WorldToScreenPoint(unit.thisT.position + new Vector3(0, 2, 0)); screenPos.z = 0; rectT.localPosition = screenPos * UIMainControl.GetScaleFactor(); rectT.sizeDelta = new Vector2((unit.hitPoint / unit.hitPointFull) * fullSize.x, fullSize.y); }
void Update() { UnitPlayer player = GameControl.GetPlayer(); if (player == null) { return; } cursorT.localPosition = Input.mousePosition * UIMainControl.GetScaleFactor(); rectDefaultCursor.sizeDelta = cursorDefaultSize + new Vector2(player.GetRecoil() * 2, player.GetRecoil() * 2); if (player.Reloading()) { ShowReloading(); imgReloading.fillAmount = player.GetCurrentReload() / player.GetReloadDuration(); } else { HideReloading(); } }