integration
bad other team code on another branch
This commit is contained in:
parent
7925fd966a
commit
521a62973a
278 changed files with 11344 additions and 0 deletions
37
Assets/Scripts/PV METER.cs
Executable file
37
Assets/Scripts/PV METER.cs
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PVMETER : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Image PVMeter;
|
||||
private float PVm;
|
||||
private float PVMax;
|
||||
public Gradient colorGradient;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Debug.Log("JE SUIS LA");
|
||||
var gradient = new Gradient();
|
||||
|
||||
var colors = new GradientColorKey[2];
|
||||
colors[0] = new GradientColorKey(Color.red, 0.0f);
|
||||
colors[1] = new GradientColorKey(Color.green, 1.0f);
|
||||
|
||||
var alphas = new GradientAlphaKey[2];
|
||||
alphas[0] = new GradientAlphaKey(1.0f, 0.0f);
|
||||
alphas[1] = new GradientAlphaKey(1.0f, 0.0f);
|
||||
|
||||
gradient.SetKeys(colors, alphas);
|
||||
|
||||
PVm = GetComponent<BaseDuckScript>().getHealth() / GetComponent<BaseDuckScript>().getBaseHealth();
|
||||
Debug.Log(PVm);
|
||||
PVMeter.fillAmount = PVm;
|
||||
PVMeter.color = colorGradient.Evaluate(PVm);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue