예제 #1
0
 public override ActionTransition Start(ActionTransition PreviousAction)
 {
     //Transition.FromAction = this;
     //ParentActor.Locomotion.LocomotionProxy.GoToTarget(MovementSpeed.Walk);
     Console.WriteLine("Action started");
     return null;
 }
예제 #2
0
 public override ActionTransition Start(ActionTransition PreviousAction)
 {
     //ParentActor.Locomotion.LocomotionProxy.SetTarget(((SenseQuery)PreviousAction.Data).SensedActors[0]);
     return null;
 }
예제 #3
0
 public virtual ActionTransition Suspend(ActionTransition PreviousAction)
 {
     return null;
 }
예제 #4
0
 public virtual ActionTransition Resume(ActionTransition PreviousAction)
 {
     return null;
 }
예제 #5
0
 public virtual ActionTransition Start(ActionTransition PreviousAction)
 {
     Console.Write("Starting new action: ");
     Console.WriteLine(PreviousAction.Reason);
     return null;
 }
예제 #6
0
 public override ActionTransition Suspend(ActionTransition PreviousAction)
 {
     return base.Suspend(PreviousAction);
 }
예제 #7
0
 public virtual void End()
 {
     actionTransition = null;
 }
예제 #8
0
 public override ActionTransition Resume(ActionTransition PreviousAction)
 {
     return base.Resume(PreviousAction);
 }
예제 #9
0
 public override ActionTransition Start(ActionTransition PreviousAction)
 {
     loco.GenerateRandomPath();
     //ParentActor.Locomotion.LocomotionProxy.SetRandomDestination();
     return null;
 }
예제 #10
0
 public void Add(ActionTransition ActionToQueue)
 {
     ActionQueue.Add(ActionToQueue);
 }
예제 #11
0
 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);
 }
예제 #12
0
 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);
 }
예제 #13
0
 private void Resume(ActionTransition transition)
 {
     CurrentAction.End();
     CurrentAction = SuspendedAction;
     SuspendedAction = null;
     ActionTransition tran = CurrentAction.Resume(transition);
     if (tran != null) ProcessTransition(tran);
 }
예제 #14
0
        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;

            }
        }
예제 #15
0
        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);
            }
        }
예제 #16
0
 public void PriorityAdd(ActionTransition ActionToQueue)
 {
     for (int i = 0; i < ActionQueue.Count; i++)
     {
         if (ActionToQueue.Priority > ActionQueue[i].Priority) ActionQueue.Insert(i, ActionToQueue);
     }
 }