public ITask GenerateTask() { Queue <ITask> queuedTasks = new Queue <ITask>(); ITask compositeTask = new CompositeTask(queuedTasks); ITask findFood = new FindTask <Food>(_owningAgent, (target, food) => { // Called when food found. Create seek task. ITask seekFood = new SeekTask(_owningAgent, target, 3, () => { ITask intentTask = new IntentTask(_owningAgent, food, EIntent.EAT, () => { EnergyCompontent foodEnergy = food.TakeEnergy(new EnergyCompontent { EnergyType = EEnergyType.NOURISHMENT }); _owningAgent.GiveEnergy(new EnergyCompontent { EnergyType = EEnergyType.NOURISHMENT, KiloJoules = foodEnergy.KiloJoules }); }); queuedTasks.Enqueue(intentTask); }); queuedTasks.Enqueue(seekFood); }); queuedTasks.Enqueue(findFood); compositeTask.Start(); return(compositeTask); }
private void bntGetObject_Clicked(object sender, EventArgs e) { // StyleId exist in all View and most of the time is not used, use this as a hint to copy all properties from Control to Element //dataForm.StyleId = "sis"; IntentTask tsk = dataForm.DataObject as IntentTask; if (tsk.IntentTaskTitle == null) { App.Current.MainPage.DisplayAlert("don care in wpf", "Please set title property", "OK"); } else { App.Current.MainPage.DisplayAlert(tsk.IntentTaskTitle, tsk.IntentTaskTitle, "OK"); } }