public override ActionTransition Start(ActionTransition PreviousAction) { //Transition.FromAction = this; //ParentActor.Locomotion.LocomotionProxy.GoToTarget(MovementSpeed.Walk); Console.WriteLine("Action started"); return null; }
public override ActionTransition Start(ActionTransition PreviousAction) { //ParentActor.Locomotion.LocomotionProxy.SetTarget(((SenseQuery)PreviousAction.Data).SensedActors[0]); return null; }
public virtual ActionTransition Suspend(ActionTransition PreviousAction) { return null; }
public virtual ActionTransition Resume(ActionTransition PreviousAction) { return null; }
public virtual ActionTransition Start(ActionTransition PreviousAction) { Console.Write("Starting new action: "); Console.WriteLine(PreviousAction.Reason); return null; }
public override ActionTransition Suspend(ActionTransition PreviousAction) { return base.Suspend(PreviousAction); }
public virtual void End() { actionTransition = null; }
public override ActionTransition Resume(ActionTransition PreviousAction) { return base.Resume(PreviousAction); }
public override ActionTransition Start(ActionTransition PreviousAction) { loco.GenerateRandomPath(); //ParentActor.Locomotion.LocomotionProxy.SetRandomDestination(); return null; }
public void Add(ActionTransition ActionToQueue) { ActionQueue.Add(ActionToQueue); }
public void ChangeTo(ActionTransition transition) { if (CurrentAction != null) { CurrentAction.End(); } CurrentAction = ActionStorage.GetAction(transition.ToAction); ActionTransition tran = CurrentAction.Start(transition); if (tran != null) ProcessTransition(tran); }
private void Suspend(ActionTransition transition) { CurrentAction.Suspend(transition); SuspendedAction = CurrentAction; CurrentAction = ActionStorage.GetAction(transition.ToAction); ActionTransition tran = CurrentAction.Start(transition); if (tran != null) ProcessTransition(tran); }
private void Resume(ActionTransition transition) { CurrentAction.End(); CurrentAction = SuspendedAction; SuspendedAction = null; ActionTransition tran = CurrentAction.Resume(transition); if (tran != null) ProcessTransition(tran); }
private void ProcessTransition(ActionTransition transition) { switch (transition.Transition) { case TransitionType.Change: ChangeTo(transition); break; case TransitionType.Suspend: Suspend(transition); break; case TransitionType.Resume: Resume(transition); break; case TransitionType.End: CurrentAction.End(); CurrentAction = null; break; case TransitionType.Wait: WaitUntil((float)Convert.ToDouble(transition.Data)); break; } }
public void Update() { if (CurrentAction != null && WaitOver) { if (updateReturn == null) { updateReturn = CurrentAction.Update(); iterator = updateReturn.GetEnumerator(); } iterator.MoveNext(); returnedTransition = iterator.Current; if (returnedTransition != null) { ProcessTransition(returnedTransition); } } else if (CurrentAction == null && ActionQueue.Count > 0) { returnedTransition = ActionQueue[0]; ActionQueue.RemoveAt(0); ProcessTransition(returnedTransition); } }
public void PriorityAdd(ActionTransition ActionToQueue) { for (int i = 0; i < ActionQueue.Count; i++) { if (ActionToQueue.Priority > ActionQueue[i].Priority) ActionQueue.Insert(i, ActionToQueue); } }