public override string GetText() { float xp = 0; XPHandler xpComponent = player.GetComponent <XPHandler>(); if (xpComponent != null) { xp = xpComponent.GetXp(); xp = Mathf.Floor(xp); } return(xp.ToString()); }
public void DoDamage(Component enemy) { if (Utility.HealthUtility.DeductHealth(enemy, damage)) { Destroy(enemy.gameObject); XPHandler xpComponent = this.GetComponent <XPHandler>(); if (xpComponent != null) { xpComponent.AddXp(10); } Debug.Log("Destroyed2"); } }
public override float GetWidth() { float baseWidth = Screen.width - (Screen.width / 3); float newWidth = this.width; float xp = 0; XPHandler xpComponent = player.GetComponent <XPHandler>(); if (xpComponent != null) { xp = xpComponent.GetXp(); } if (xp > 0) { newWidth = baseWidth * xp / 1000; } else { newWidth = 0; } return(newWidth); }