private int energy=100;
    public Text energysNum;

    void Update()
    {
        if (Time.time >= nextTime) 
            {
                energy--;
                energysNum.text = energy.ToString();
                if (energy == 0)
                {
                    Invoke("success", 0.5f);
                }
                nextTime = Time.time + 1;
            }
    }