public float GetLifePercentage() { // calculate percentage float lifePercentage = Life / MaxLife; // keep in bounds if (lifePercentage > 1f) lifePercentage = 1f; if (lifePercentage < 0f) lifePercentage = 0f; return lifePercentage; }