Example #1
0
    // Update is called once per frame
    void Update()
    {
        PlayerEnergy PE     = Player.GetComponent <PlayerEnergy>();
        float        energy = PE.GetEnergy();
        float        ratio  = energy / PE.maxEnergy;

        float current = GetComponent <Image>().fillAmount;

        GetComponent <Image>().fillAmount = Mathf.Lerp(current, ratio, lerpSpeed * Time.deltaTime);
    }
 // Update is called once per frame
 void Update()
 {
     sflight.intensity =
         (float)(minIntensity + (maxIntensity - minIntensity) * (pe.GetEnergy() / pe.maxEnergy));
 }