/// <summary> /// Called whenever the player is removed from the PlayerManager /// </summary> public void OnRemoved() { if (healthBarManager) { healthBarManager.Remove(this); } if (nameTagManager) { nameTagManager.Remove(this); } }
// Update is called once per frame void Update() { if (Target == null || !((MonoBehaviour)Target)) { if (Manager) { Manager.Remove(this); } Destroy(gameObject); return; } //transform.position = Target.Transform.position + (Vector3.up * 2f); UpdateHealth(); }
// Update is called once per frame void Update() { if (this.Target == null || !((MonoBehaviour)Target)) { if (Manager) { Manager.Remove(this); } Destroy(this.gameObject); return; } if (this.canvasGroup) { this.canvasGroup.alpha = 1f; } var stats = this.Target.GetStats(); if (stats.IsDead || !this.Target.InCombat) { if (this.canvasGroup) { this.canvasGroup.alpha = 0f; } } var proc = stats.Health.CurrentValue > 0 ? 100f * ((float)stats.Health.CurrentValue / stats.Health.Level) : 0f; var tar = (MonoBehaviour)this.Target; if (tar) { var targetTransform = tar.transform; this.progress.sizeDelta = new Vector2(proc, 100f); this.transform.position = targetTransform.position + (Vector3.up * 2f); } }