DeathBook/Assets/Scripts/WatchArea.cs
2015-08-16 16:55:58 -04:00

30 lines
678 B
C#

using UnityEngine;
using System.Collections;
using DeathBook.Util;
using DeathBook.Model;
using UnityEngine.UI;
public class WatchArea : MonoBehaviour, IObserver
{
public RatioProgression AwarenessBar;
public Text Percentage;
// Use this for initialization
void Start ()
{
LevelManager.Instance.GameLevel.Subscribe(this);
UpdateBar();
}
public void Notify()
{
UpdateBar();
}
private void UpdateBar()
{
AwarenessBar.SetCompletedRatio(LevelManager.Instance.GameLevel.Awareness);
Percentage.text = (int)Mathf.Clamp((LevelManager.Instance.GameLevel.Awareness * 100f / 0.6f), 0f, 100f) + "%";
}
}