Category5.Tornado.GetLifePercentage C# (CSharp) Method

GetLifePercentage() public method

public GetLifePercentage ( ) : float
return float
        public float GetLifePercentage()
        {
            // calculate percentage
            float lifePercentage = Life / MaxLife;

            // keep in bounds
            if (lifePercentage > 1f)
                lifePercentage = 1f;
            if (lifePercentage < 0f)
                lifePercentage = 0f;

            return lifePercentage;
        }