public void CheckHamsterOnExerciseArea() { if (Tick.simulatorDate.Hour != 17) { var activityLogs = activityLogService .GetById(a => a.ActivityId == (int)ActivityType.Exercise) .Where(e => e.EndTime == null); foreach (var activityLog in activityLogs) { var startTime = activityLog.StartTime; if ((Tick.simulatorDate.TimeOfDay - startTime.Value.TimeOfDay).TotalMinutes > 60) { Hamster hamster = hamsterService.GetById(activityLog.HamsterId); MoveHamster(hamster, activityLog, ActivityType.Spa, AreaType.Spa); } } } }
private DateTime GetDateTime() { var activityLogs = activityLogService.GetById(a => a.ActivityId == (int)ActivityType.Arrived).OrderBy(x => x.StartTime).ToList(); if (activityLogs.Count == 0) { return(new DateTime(2022, 01, 01, 07, 00, 00)); } var lastStartTime = activityLogs.Last().StartTime; lastStartTime = lastStartTime.Value.AddDays(1); return(new DateTime(lastStartTime.Value.Year, lastStartTime.Value.Month, lastStartTime.Value.Day, 07, 00, 00)); }