// Update is called once per frame
 void Update()
 {
     if (carStatus.getMP() == carStatus.getMaxMP())
     {
         if (car.GetComponent <N2OSkill>() != null)
         {
             MoveBtnText.text = "NITRO";
         }
         if (car.GetComponent <TimeStopSkill>() != null)
         {
             MoveBtnText.text = "TIME";
         }
         if (car.GetComponent <CoinAttackSkill>() != null)
         {
             MoveBtnText.text = "CASH CHUCKER";
         }
         if (car.GetComponent <FlameSkill>() != null)
         {
             MoveBtnText.text = "DRAGON'S BREATH";
         }
         if (car.GetComponent <SpearSkill>() != null)
         {
             MoveBtnText.text = "ACHILLES";
         }
     }
     else
     {
         MoveBtnText.text = "";
     }
 }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        float maxWidth = 2;
        float width    = maxWidth;

        if (car != null)
        {
            if (isHPBar)
            {
                width *= (carStatus.getHP() / carStatus.getMaxHP());
            }
            else
            {
                width *= (carStatus.getMP() / carStatus.getMaxMP());
            }
        }
        width = Mathf.Clamp(width, 0, 2);
        rectTransform.sizeDelta = new Vector2(width, rectTransform.sizeDelta.y);
    }