// Start is called before the first frame update void Start() { for (var i = 0; i < baseEnemyCount; i++) { others.Add(Instantiate(enemyPrefab)); } Scheduler.AddEvent(5, () => StartCoroutine(Decrease())); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); stop = true; timer = 5; Scheduler.AddEvent(ChangeDirection, 2); Scheduler.AddEvent(() => { stop = false; animator.SetBool("Running", true); }, 2); }
/// <summary> /// Add WorkingShift (events) in the scheduler. WorkingShift is for an employed. /// </summary> /// <param name="wsList">List of WorkingShift</param> /// <param name="scheduler">Scheduler, see WpfScheduler for more...</param> public static void AddWorkingShiftScheduler(List <WorkingShift> wsList, Scheduler scheduler) { foreach (WorkingShift ws in wsList) { scheduler.AddEvent(new Event() { Subject = ws.Person.firstName + " " + ws.Person.name, Description = ws.description, Color = colorPiker(ws.Person), Start = (System.DateTime)ws.start, End = (System.DateTime)ws.end, }); } }
// <summary> /// Insert data in the database /// if the record is already existing, it will update it /// if the record isnt existing, it will create it and add it /// </summary> /// <param>None</param> private void btnSave_Click(object sender, RoutedEventArgs e) { if (isDateChecked() && areDatesCorrect()) { current.DayOfWeek = cbDayOfWeekSlot.SelectedIndex; current.MinAttendency = Int32.Parse(cbAttendencySlot.Text); current.FirstDay = (DateTime)dpFirstDay.SelectedDate; current.LastDay = (DateTime)dpLastDay.SelectedDate; current.Start = current.Start.AddHours(Int32.Parse(cbStartHourHourSlot.Text)); current.Start = current.Start.AddMinutes(Int32.Parse(cbStartHourMinuteSlot.Text)); current.End = current.End.AddHours(Int32.Parse(cbEndHourHourSlot.Text)); current.End = current.End.AddMinutes(Int32.Parse(cbEndHourMinuteSlot.Text)); if (modified) { scheduler.DeleteEvent(idBckCurrent); current.Color = new SolidColorBrush(Colors.Coral); } else { current.Color = new SolidColorBrush(Colors.OrangeRed); } current.Subject = "Date départ : " + current.FirstDay.ToString("MM/dd/yyyy") + Environment.NewLine + Environment.NewLine + "Date de fin : " + current.LastDay.ToString("MM/dd/yyyy") + Environment.NewLine + Environment.NewLine + "Mininum : " + current.MinAttendency.ToString(); scheduler.AddEvent(current); this.Close(); } else { MessageBox.Show("Veuillez remplir les champs \"Premier jour\" et \"Dernier Jour\"" + "\n" + " et vérifier que le premier jour soit avant ou égal au dernier jour"); } }
public IActionResult ScheduleTimeBased(string deviceName, string moduleName) { var module = DeviceStorage.GetDeviceByName(deviceName).GetModuleByName(moduleName); Random rand = new Random(); SmSEvent smSEvent = new TimeEvent("AutoGeneratedEvent", module, rand.Next(1, 250)); var time = DateTime.Now.AddSeconds(5); (smSEvent as TimeEvent).TriggerAt(time); Scheduler.AddEvent(smSEvent); // DevModelHandler.deviceModel.Find(x => x.DeviceInfo.Device.Name == deviceName).DeviceInfo.Device.ExternalName = "Tesst"; //var test = Request ViewData["Message"] = "Settings general page."; return(View("Devices", DevModelHandler.deviceModel)); }
private void ChangeDirection() { var dir = Stage.route[x * 5 + y]; bool[] can = { true, true, true, true }; for (var i = 0; i < dir.Count; i++) { can[dir[i]] = false; } int rand = 0; do { rand = Random.Range(0, 4); } while (!can[rand]); Vector3 aim = Vector3.zero; switch (rand) { case 0: aim = Vector3.left; x--; break; case 1: aim = Vector3.right; x++; break; case 2: aim = Vector3.back; y--; break; case 3: aim = Vector3.forward; y++; break; } transform.forward = aim; rb.velocity = aim * 2; Scheduler.AddEvent(ChangeDirection, 4); }