using UnityEngine;
using System.Collections;

public class PlayerStat : MonoBehaviour {
	
	public static PlayerStat instance;

	public float playerTime;
	public float decreaseVelocity;

	public bool boiaSaiu =false;
	public bool invencible=false;

	public int score;


	void Start(){
		if(instance==null){
			instance = this;
		}
	}
	void Update(){
		DecreaseTime ();
		if(playerTime<0){
			GameManager.instance.OnDead ();
		}
		if(playerTime>1){
			playerTime = 1;
		}
		UiManager.instance.ChangeScore (score);
	}

	void DecreaseTime(){
		playerTime = playerTime - (decreaseVelocity * Time.deltaTime)/100;
		UiManager.instance.ChangeTimeBar(playerTime);
	}

}
