gold_sprint_lpr/Assets/Scripts/GameScene/HUDProgress.cs

28 lines
718 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HUDProgress : MonoBehaviour {
public GameObject start;
public GameObject end;
public GameObject progress;
private Transform tstart;
private Transform tend;
// Use this for initialization
void Start () {
tstart = start.GetComponent<Transform>();
tend = end.GetComponent<Transform>();
//progress = new GameObject("Progress");
progress.transform.parent = tstart;
progress.transform.localPosition = new Vector3(0, 0, 0);
}
public void SetProgress(float p) {
progress.transform.position = tstart.position * (1 - p) + tend.position * p;
}
}