PlaneRun/Assets/Scripts/misslePickup.cs

29 lines
520 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class misslePickup : MonoBehaviour
{
public Image timeLeftImg;
public float time;
private float t;
// Start is called before the first frame update
void Start()
{
t = time;
}
// Update is called once per frame
void Update()
{
t -= Time.deltaTime;
timeLeftImg.fillAmount = t / time;
if (t <= 0)
Destroy(gameObject);
}
}