diff --git a/MoCha/Assets/Scenes/Goals.unity b/MoCha/Assets/Scenes/Goals.unity index 9bb606e..167c118 100644 Binary files a/MoCha/Assets/Scenes/Goals.unity and b/MoCha/Assets/Scenes/Goals.unity differ diff --git a/MoCha/Assets/Scripts/GetGoals.cs b/MoCha/Assets/Scripts/GetGoals.cs index f4850d9..df7b284 100644 --- a/MoCha/Assets/Scripts/GetGoals.cs +++ b/MoCha/Assets/Scripts/GetGoals.cs @@ -6,7 +6,8 @@ using UnityEngine; using UnityEngine.UI; //Pretty much a copy of GetData... - +namespace PedometerU.Tests { + public class GetGoals : MonoBehaviour { public Text goalText; @@ -20,24 +21,36 @@ public class GetGoals : MonoBehaviour { //Progress Bar... public float barDisplay; //current progress - public Vector2 barPos; + private Vector2 barPos; Vector2 barSize = new Vector2(227,20); + //Pedometer + private Pedometer pedometer; + int userSteps; + double userDistance; + int totalSteps = 30; + + void OnStep (int steps, double distance) { + userSteps = steps; + userDistance = (distance * 3.28084); + } + + private void OnDisable () { + // Release the pedometer + pedometer.Dispose(); + pedometer = null; + } + void Start () { + // Create a new pedometer + pedometer = new Pedometer(OnStep); + // Reset UI + OnStep(0, 0); + //goalText.text = prefKey; goalText.color = new Color(0f, 0f, 0f); - goalText.transform.position = new Vector2(barPos.x + 45.0f,barPos.y + 55.0f); - - - //barPos.x = goalText.transform.position.x; - //barPos.y = goalText.transform.position.y + 10.0f; - - //Debug.Log(barPos.x + " " + barPos.y); - - //barPos.x = 0; - //barPos.y = 0; - + barPos = new Vector2(goalText.transform.position.x - 105, goalText.transform.position.y - 30); currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); @@ -87,8 +100,8 @@ public class GetGoals : MonoBehaviour { //needs current points counting toward this goal (daily?) //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 = Time.time*0.05f; //put actual progress here (current/total) + barDisplay = userSteps/totalSteps; //failed to complete goal if(currentDayStr != goalDayStr) { @@ -122,3 +135,4 @@ public class GetGoals : MonoBehaviour { } } } +} \ No newline at end of file diff --git a/MoCha/ProjectSettings/ProjectVersion.txt b/MoCha/ProjectSettings/ProjectVersion.txt index ac7d214..27997c5 100644 --- a/MoCha/ProjectSettings/ProjectVersion.txt +++ b/MoCha/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.4.0f1 +m_EditorVersion: 2017.3.1f1