// Update is called once per frame void Update() { if (ownerData != null && ownerData.GetOwner().IsInteractable()) { return; } if (center != null) { Vector3 pos = center.transform.position + new Vector3(0, distance, 0); transform.position = pos; transform.rotation = Quaternion.identity; } if (hp == 0 && maxHp == 0) { return; } percent = (int)(hp / (float)maxHp * 100); percent = 100 - percent; if (currentPercent != percent) { dmg.transform.localScale = new Vector3(0.0341f * percent, 0.68f, 0); currentPercent = percent; } if (cooldownBar != null) { ActiveSkill sk = ownerData.GetOwner().MeleeSkill; float lastUse = sk.LastUsed; float reuse = sk.GetReuse(false); float passed = Time.time - lastUse; float ratio = passed / reuse; //Debug.Log(ratio); percent = (int)(ratio * 100); if (percent > 100) { percent = 100; } if (currentPercentCooldown != percent) { if (percent == 100) { mat.SetColor("_Color", new Color(227 / 255f, 176 / 255f, 57 / 255f, 187 / 255f)); } else if (currentPercentCooldown == 100) { mat.SetColor("_Color", new Color(176 / 255f, 145 / 255f, 73 / 255f, 187 / 255f)); } cooldownMarker.transform.localScale = new Vector3(0.0341f * percent, 0.68f, 0); currentPercentCooldown = percent; } } }