diff --git a/MoCha/Assets/Scripts/GetGoals.cs b/MoCha/Assets/Scripts/GetGoals.cs index 1a993e0..1ab1556 100644 --- a/MoCha/Assets/Scripts/GetGoals.cs +++ b/MoCha/Assets/Scripts/GetGoals.cs @@ -7,22 +7,19 @@ using UnityEngine.UI; //Pretty much a copy of GetData... namespace PedometerU.Tests { - + public class GetGoals : MonoBehaviour { public Text goalText; - public string currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); public string goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); - public string prefKey; - public float goalValue; //Progress Bar... public float barDisplay; //current progress private Vector2 barPos; - Vector2 barSize = new Vector2(227,20); + private Vector2 barSize = new Vector2(227,20); //Pedometer private Pedometer pedometer; @@ -30,11 +27,12 @@ public class GetGoals : MonoBehaviour { double userDistance; int totalSteps = 30; public Text stepText; - + void OnStep (int steps, double distance) { userSteps = steps; - stepText.text = steps.ToString (); + stepText.text = steps.ToString (); userDistance = (distance * 3.28084); + PlayerPrefs.setInt("currentSteps",userSteps); } private void OnDisable () { @@ -47,8 +45,8 @@ public class GetGoals : MonoBehaviour { // Create a new pedometer pedometer = new Pedometer(OnStep); // Reset UI - OnStep(0, 0); - + OnStep(PlayerPrefs.getInt("currentSteps"), 0); + //goalText.text = prefKey; goalText.color = new Color(0f, 0f, 0f); @@ -103,7 +101,8 @@ public class GetGoals : MonoBehaviour { //needs the total required points for this goal currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); //barDisplay = Time.time*0.05f; //put actual progress here (current/total) - barDisplay = (float)userSteps/(float)totalSteps; + barDisplay = (float)userSteps/(float)totalSteps; + //failed to complete goal if(currentDayStr != goalDayStr) { @@ -137,4 +136,5 @@ public class GetGoals : MonoBehaviour { } } } -} \ No newline at end of file + +}