Exemplo n.º 1
0
    void Update()
    {
        float lifePercent = Mathf.InverseLerp(0, critter.getMaxLife(), critter.getLife());

        Color currentColor;

        if (lifePercent > 0.5f)
        {
            currentColor = Color.Lerp(midColor, healtyColor, 2f * (lifePercent - .5f));
        }
        else
        {
            currentColor = Color.Lerp(starvingColor, midColor, 2f * lifePercent);
        }

        torzo.color = currentColor;
    }
Exemplo n.º 2
0
 public int SampleLife()
 {
     return(critterCtrl.getLife());
 }