示例#1
0
 protected AbstractVectorActionPlus(IVectorBehaviourPlus behaviour, TimeSpan?timeout, bool needsControl)
 {
     Behaviour    = behaviour;
     Created      = DateTime.Now;
     State        = ActionState.Pending;
     StartTimeout = timeout;
     NeedsControl = needsControl;
 }
        public async Task AddBehaviourAsync(IVectorBehaviourPlus behaviour)
        {
            if (!Behaviours.Any(b => b.UniqueReference == behaviour.UniqueReference))
            {
                Behaviours.Add(behaviour);
                UpdateFrameProcessors();

                if (Connection == ConnectedState.Connected)
                {
                    await ActOnAnyBehaviourPermanentRequirements();
                    await RegisterBehavioursAsync(new[] { behaviour });
                }

                if (behaviour.ActionOnAdded != null)
                {
                    EnqueueAction(behaviour.ActionOnAdded);
                }

                OnBehaviourEvent?.Invoke(Behaviours, BehaviourEvent.Add);
            }
        }
示例#3
0
 public StopAllMotorsAction(IVectorBehaviourPlus behaviour, TimeSpan?timeout) : base(behaviour, timeout, true)
 {
 }
 public SimpleSpeechAction(IVectorBehaviourPlus behaviour, string speech) : base(behaviour, TimeSpan.FromSeconds(15), true)
 {
     this.speech = speech;
 }
示例#5
0
 public TurnToFaceAction(IVectorBehaviourPlus behaviour, TimeSpan?timeout, Face face) : base(behaviour, timeout, true)
 {
     this.face = face;
 }
 public static VectorBehaviourPlusReport FromException(Exception e, Robot robot = null, IVectorControllerPlus controller = null, IVectorBehaviourPlus behaviour = null)
 {
     return(new VectorBehaviourPlusReport()
     {
         Description = e.Message,
         Controller = controller,
         Robot = robot,
         Behaviour = behaviour
     });
 }
示例#7
0
 public BirthdaySongAction(IVectorBehaviourPlus behaviour, TimeSpan?timeout) : base(behaviour, timeout, true)
 {
 }
示例#8
0
 public ExterminateAction(IVectorBehaviourPlus behaviour, TimeSpan?timeout) : base(behaviour, timeout, true)
 {
 }
示例#9
0
 public OfferTeaAction(IVectorBehaviourPlus behaviour, TimeSpan?timeout, string name = null) : base(behaviour, timeout, true)
 {
     this.name = name;
 }
示例#10
0
 public FaceSomeoneAction(IVectorBehaviourPlus behaviour, TimeSpan?timeout) : base(behaviour, timeout, true)
 {
 }