public void UpdateText() { workoutData.EstablishMinutes(); _workoutName.text = workoutData.name; if (workoutData.minutes < 1) { _minutesLabel.text = "0 min"; } else { _minutesLabel.text = workoutData.minutes + " min"; } }
public void GenerateRandomWorkout() { WorkoutPanel[] workoutPanels = FindObjectsOfType <WorkoutPanel>(); if (workoutPanels != null) { foreach (WorkoutPanel workoutPanel in workoutPanels) { if (workoutPanel.workoutData.workoutType == WorkoutType.wod) { AreYouSurePanel.Instance.DeleteWorkout(workoutPanel); } } } DetermineViableExercises(); randomWorkout = new WorkoutData(); string newWorkoutName = "W.O.D. " + DateTime.Now.Month + "/" + DateTime.Now.Day; randomWorkout.name = randomWorkout.name = newWorkoutName; randomWorkout.workoutType = WorkoutType.wod; randomWorkout.secondsBetweenExercises = secondsBetweenExercises; randomWorkout.exerciseData = new List <ExerciseData>(); while (randomWorkout.minutes < desiredMinutesInWorkout - 3) { bool foundExercise = false; while (!foundExercise) { int randomExerciseIndex = UnityEngine.Random.Range(0, viableExercises.Count); if (randomWorkout.exerciseData.Contains(viableExercises[randomExerciseIndex])) { foundExercise = false; //return; } else { randomWorkout.exerciseData.Add(viableExercises[randomExerciseIndex]); randomWorkout.EstablishMinutes(); foundExercise = true; } } } //Add randomWorkout to app WorkoutHUD.Instance.AddWorkoutPanel(randomWorkout, false); SoundManager.Instance.PlayButtonPressSound(); WorkoutManager.Instance.Save(); }
public void UpdateText() { workoutData.EstablishMinutes(); _workoutName.text = workoutData.name; _minutesLabel.text = workoutData.minutes + " min"; }