init
This commit is contained in:
commit
001bb14f16
951 changed files with 270074 additions and 0 deletions
43
Assets/Scripts/Player/LightBar.cs
Normal file
43
Assets/Scripts/Player/LightBar.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LightBar : MonoBehaviour{
|
||||
|
||||
public float maxTime;
|
||||
[HideInInspector]
|
||||
public float time;
|
||||
public Animator anim;
|
||||
|
||||
float timeRest = 1;
|
||||
bool brujula;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
time = maxTime;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
if (Input.GetButtonDown("Fire")){
|
||||
if (brujula){
|
||||
timeRest = 2;
|
||||
}else{
|
||||
timeRest = 1;
|
||||
}
|
||||
}
|
||||
if (time > 0){
|
||||
time = time - timeRest * Time.deltaTime;
|
||||
}
|
||||
if (time / maxTime < 0.75f){
|
||||
anim.SetFloat("State", 2);
|
||||
}
|
||||
if (time / maxTime < 0.5f){
|
||||
anim.SetFloat("State", 3);
|
||||
}
|
||||
if (time / maxTime < 0.25f){
|
||||
anim.SetFloat("State", 4);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue