playerpref steps
This commit is contained in:
parent
f3c4d0b610
commit
c2ed30d441
1 changed files with 11 additions and 11 deletions
|
@ -11,18 +11,15 @@ 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;
|
||||
|
@ -35,6 +32,7 @@ public class GetGoals : MonoBehaviour {
|
|||
userSteps = steps;
|
||||
stepText.text = steps.ToString ();
|
||||
userDistance = (distance * 3.28084);
|
||||
PlayerPrefs.setInt("currentSteps",userSteps);
|
||||
}
|
||||
|
||||
private void OnDisable () {
|
||||
|
@ -47,7 +45,7 @@ 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);
|
||||
|
@ -104,6 +102,7 @@ public class GetGoals : MonoBehaviour {
|
|||
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||
//barDisplay = Time.time*0.05f; //put actual progress here (current/total)
|
||||
barDisplay = (float)userSteps/(float)totalSteps;
|
||||
|
||||
//failed to complete goal
|
||||
if(currentDayStr != goalDayStr)
|
||||
{
|
||||
|
@ -137,4 +136,5 @@ public class GetGoals : MonoBehaviour {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue