public void Process(NonBlockingChannel statusChannel, ITaskable uiTask) { var inboundChannel = new NonBlockingChannel(); var baristaOutboundChannel = new EnumerableChannel<IMessage>(); var customerOutboundChannel = new EnumerableChannel<IMessage>(); var registerOutboundChannel = new EnumerableChannel<IMessage>(); var abandonedMessages = new NonBlockingChannel(); var messageRouter = new OrderingProcessMessageRouter( inboundChannel, baristaOutboundChannel, customerOutboundChannel, registerOutboundChannel, abandonedMessages, statusChannel); var baristaActor = new BaristaActor(inboundChannel, baristaOutboundChannel); var customerActor = new CustomerActor(inboundChannel, customerOutboundChannel); var registerActor = new RegisterActor(inboundChannel, registerOutboundChannel); //ThreadPool.QueueUserWorkItem(x => messageRouter.Process()); //ThreadPool.QueueUserWorkItem(x => baristaActor.Process()); //ThreadPool.QueueUserWorkItem(x => customerActor.Process()); //ThreadPool.QueueUserWorkItem(x => registerActor.Process()); //ThreadPool.QueueUserWorkItem(x => uiTask.Process()); new Thread(messageRouter.Process).Start(); new Thread(baristaActor.Process).Start(); new Thread(customerActor.Process).Start(); new Thread(registerActor.Process).Start(); new Thread(uiTask.Process).Start(); }
// Dweller Always pulls from Bunny 's right , ... forget it , just make a pull 2L and pull 2R objects public TA_DwellerPullCoord_2L(ITaskable taskableAnimal, ITaskable theOtherstolenFrom /* , AnimalCharacterHands argTheirhandFrom, AnimalCharacterHands argMyHandTO*/) { TheCharacter = taskableAnimal; TheOTHERCharacter = theOtherstolenFrom; FromHand = AnimalCharacterHands.Right; ToMyHand = AnimalCharacterHands.Left;//<--------------------------------------------2L }
public Sequence(ITaskable taskable) { this.taskable = taskable; this.tasks = new List <Task>(); Push(this); }
public TA_Coordination(ITaskable taskableAnimal, ITaskable theOtherstolenFrom, AnimalCharacterHands argTheirhandFrom, AnimalCharacterHands argMyHandTO) { TheCharacter = taskableAnimal; TheOTHERCharacter = theOtherstolenFrom; FromHand = argTheirhandFrom; ToMyHand = argMyHandTO; }
public void PopTill(ITaskable task) { if (task == null) { return; } if (stacked.Count > 0 && !Equals(stacked.Last(), task)) { RemoveLast(false); while (stacked.Count > 0 && !Equals(stacked.Last(), task)) { //stacked.Last().Destroy(); stacked.RemoveAt(stacked.Count - 1); } } if (stacked.Count > 0) { stacked.Last().OnEnter(); } else { AddTask(task); } }
public TA_BellHopPull(ITaskable taskableAnimal, ITaskable theOtherstolenFrom, AnimalCharacterHands argTheirhandFrom /*, AnimalCharacterHands argMyHandTO*/) //bellhopalwayspulls to his right { TheCharacter = taskableAnimal; TheOTHERCharacter = theOtherstolenFrom; FromHand = argTheirhandFrom; ToMyHand = AnimalCharacterHands.Right;//Bellhop always pulls to his RIght hand making it the context item the first time he gets it }
/// <summary> /// Removes task from taskable /// </summary> public Task RemoveFrom(ITaskable taskable) { if (taskables.Contains(taskable)) { taskable.RemoveTask(this); } return(this); }
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (stateInfo.IsTag("Done.Tag")) { ITaskable _itaskble = animator.gameObject.GetComponent <ITaskable>(); _itaskble.TaskEnded(); } }
internal void AddTask(ITaskable task) { if (stacked.Count != 0) { stacked.Last().OnLeave(); } stacked.Add(task); //task.Create(); task.OnEnter(); }
public static TaskHandler Instance(ITaskable taskableObj) { var componentName = taskableObj.Name; if (!_tasks.ContainsKey(taskableObj.Name)) { var handler = new TaskHandler(); handler._action = taskableObj.Operation; handler._waitHandle = taskableObj.WaitHandle; handler._abortHandle = taskableObj.AbortHandle; _tasks[componentName] = handler; } return _tasks[componentName]; }
public static TaskHandler Instance(ITaskable taskableObj) { var componentName = taskableObj.Name; if (!_tasks.ContainsKey(taskableObj.Name)) { var handler = new TaskHandler(); handler._action = taskableObj.Operation; handler._waitHandle = taskableObj.WaitHandle; handler._abortHandle = taskableObj.AbortHandle; _tasks[componentName] = handler; } return(_tasks[componentName]); }
/// <summary> /// Starts the task by adding it into the <see cref="T:Momentum.Juggler"/> and keeping track of taskable /// </summary> public Task Start(ITaskable taskable) { return(Start() .AddTo(taskable)); }
/// <summary> /// Creates a new tasks; adds it to a taskable; starts it right away /// </summary> public static Task Run(ITaskable taskable) { return(new Task(taskable) .Start()); }
public Task(ITaskable taskable) : this() { AddTo(taskable); }
/// <summary> /// Adds task to taskable /// </summary> public Task AddTo(ITaskable taskable) { taskables.Add(taskable); taskable.AddTask(this); return(this); }
public TA_MoveOnTrig(ITaskable taskableAnimal, float argDelay) { TheCharacter = taskableAnimal; _timbeforeTrig = argDelay; }
internal bool IsCurrant(ITaskable task) { return(Equals(GetCurrant(), task)); }
internal void RemoveLast(ITaskable task) { int index = stacked.LastIndexOf(task); RemoveAt(index); }
public TA_InstantTaskHandShowHide(ITaskable taskableAnimal, AnimalCharacterHands argsideTosHow, bool arghow) { TheCharacter = taskableAnimal; _isShow = arghow; _handSide = argsideTosHow; }
public TA_DwellerWarp(ITaskable taskableAnimal, Transform argNaveTarg) { TargetNavTrans = argNaveTarg; TheCharacter = taskableAnimal; }
public TA_DwellerAnimate(ITaskable taskableAnimal, string argAnimationStateToCrossfade) { _animaStateName = argAnimationStateToCrossfade; _theCharacter = taskableAnimal; }