public IEnumerator EndWorkoutRoutine(string Identifier) { if (!workout.workoutInProgress) { YUR_Log.Warning("There is no workout currently in progress to end!"); yield break; } workout.workoutInProgress = false; int Calories; yield return(Calories = (int)Mathf.Floor(Tracking.Calories.EndCalorieCounter())); yield return(new WaitForFixedUpdate()); YUR_Main.main.User_Manager.CurrentUser.Data_Current_Game.Calories_All += Calories; YUR_Main.main.User_Manager.CurrentUser.Data_Current_Game.Calories_Weekly += Calories; YUR_Main.main.User_Manager.CurrentUser.Data_Current_Game.Calories_Today += Calories; YUR_Main.main.User_Manager.CurrentUser.Data_General_Calories.Calories_All += Calories; YUR_Main.main.User_Manager.CurrentUser.Data_General_Calories.Calories_Weekly += Calories; YUR_Main.main.User_Manager.CurrentUser.Data_General_Calories.Calories_Today += Calories; YUR_Main.main.User_Manager.CurrentUser.Data_Current_Session_Calories += Calories; System.TimeSpan t; long duration; yield return(t = System.DateTime.UtcNow - new System.DateTime(1970, 1, 1)); yield return(workout.End_Time = (long)(t.TotalSeconds - workout.Time_Duration_Paused)); yield return(duration = (workout.End_Time - workout.Start_Time)); YUR_Main.main.User_Manager.CurrentUser.Data_Current_Game.Time_Played += duration; YUR_Main.main.User_Manager.CurrentUser.Data_General_Calories.Time_played += duration; YUR_Main.main.User_Manager.CurrentUser.Data_Current_Game.Last_Played = workout.End_Time; YUR_Main.main.User_Manager.CurrentUser.Data_General_Calories.Last_played = workout.End_Time; yield return(workout.Calories += (int)(Calories - workout.Paused_Calories)); yield return(workout.Identifier = Identifier); YUR_Main.main.User_Manager.CurrentUser.SaveAll(); EndWorkout?.Invoke(); yield return(new WaitForSeconds(4)); StartCoroutine(workout.UploadWorkout()); yield break; }
public static void StartingWorkout() { if (workout.workoutInProgress || Login.Status == Login.StatusType.Logged_Out) { YUR_Log.Warning("<b>Workout is either already in progress or there is no user logged in!</b>"); return; } StartWorkout?.Invoke(); Tracking.Calories.StartCalorieCounter(); System.TimeSpan t = System.DateTime.UtcNow - new System.DateTime(1970, 1, 1); workout.Calories = 0; workout.Start_Time = (long)t.TotalSeconds; return; }
public static void GetCameraObject(ref GameObject Camera) { try { if (YUR.Yur.platform == VRUiKits.Utils.VRPlatform.OCULUS) { var oculusGobject = UnityOculusLibrary.OculusHelpers.GetPlayer(); if (oculusGobject != null) { Camera = oculusGobject; return; } } var gobject = GameObject.FindGameObjectsWithTag(YUR.Yur.Settings.CameraTag); if (gobject.Length < 0) { YUR_Log.Log("Unable to find any objects with tag"); return; } foreach (var obj in gobject) { if (obj.name.Contains("eye")) { Camera = obj; return; } } } catch (System.Exception e) { YUR_Log.Warning("Error while getting camera: " + e); //var gobject = GameObject.FindGameObjectsWithTag(YUR.Yur.Settings.CameraTag); //foreach (var obj in gobject) //{ // if (obj.name.Contains("eye")) // { // return obj; // } //} } YUR_Log.Warning("Was unable to locate a valid camera tagged " + YUR.Yur.Settings.CameraTag); return; }