Пример #1
0
            public void Add(Trigger trigger, XState to_state, TransitionCallback callback)
            {
                XUtils.Assert(!mTransitions.ContainsKey(trigger));
                XTransition transition = new XTransition(to_state, callback);

                mTransitions.Add(trigger, transition);
            }
Пример #2
0
        public ClientGoalHandle <ActionSpec> initGoal <TGoal> (TGoal goal, TransitionCallback <ActionSpec> transitionCallback, FeedbackCallback <ActionSpec> feedbackCallback) where TGoal : AGoal
        {
            AActionGoal actionGoal = new ActionSpec().NewActionGoal();

//			AActionGoal actionGoal = new AActionGoal ();
            actionGoal.Header.Stamp = ROS.GetTime();
            actionGoal.GoalID       = idGenerator.generateID();
            actionGoal.Goal         = goal;
//			actionGoal.header.Stamp = ROS.GetTime ();
//			actionGoal.goal_id = idGenerator.generateID ();
//			actionGoal.goal = goal;

            CommStateMachine <ActionSpec> commStateMachine = new CommStateMachine <ActionSpec> (actionGoal, transitionCallback, feedbackCallback);

            lock ( lockObject )
            {
                var handle = list.Add(commStateMachine);

                if (sendGoalDelegate != null)
                {
                    sendGoalDelegate(actionGoal);
                }
                else
                {
                    ROS.Warn("actionlib", "Possible coding error: sendGoalDelegate set to NULL. Not going to send goal");
                }

                return(new ClientGoalHandle <ActionSpec> (this, handle, guard));
            }
        }
Пример #3
0
 public CommStateMachine(AActionGoal actionGoal, TransitionCallback <ActionSpec> transitionCallback, FeedbackCallback <ActionSpec> feedbackCallback)
 {
     UnityEngine.Debug.Assert(actionGoal != null);
     this.actionGoal         = actionGoal;
     this.transitionCallback = transitionCallback;
     this.feedbackCallback   = feedbackCallback;
     state = CommState.StateEnum.WAITING_FOR_GOAL_ACK;
 }
Пример #4
0
        /**
         * \brief Sends a goal to the ActionServer, and also registers callbacks
         * \param transitionCallback Callback that gets called on every client state transition
         * \param feedbackCallback Callback that gets called whenever feedback for this goal is received
         */
        public ClientGoalHandle <ActionSpec> sendGoal <TGoal> (TGoal goal, TransitionCallback <ActionSpec> transitionCallback, FeedbackCallback <ActionSpec> feedbackCallback) where TGoal : AGoal
        {
            ROS.Debug("actionlib", "about to start initGoal()");
            ClientGoalHandle <ActionSpec> gh = goalManager.initGoal(goal, transitionCallback, feedbackCallback);

            ROS.Debug("actionlib", "Done with initGoal()");

            return(gh);
        }
Пример #5
0
        public void AddTransitionCallback(TState source, TState target, TransitionCallback <TState> method)
        {
            var state = this[source];

            if (state == null)
            {
                throw new StateMachineException <TState>(ErrorCodes.UnknownState, source);
            }

            state.AddTransitionCallback(target, method);
        }
Пример #6
0
        public void AddTransitionCallback(TState target, TransitionCallback <TState> method)
        {
            if (!_transitionsMap.ContainsKey(target))
            {
                throw new StateMachineException <TState>(ErrorCodes.UnknownArc, StateMachineException <TState> .MakeArcName(Name, target));
            }

            var transition = _transitionsMap[target];

            transition.AddTransitionCallback(method);
        }
Пример #7
0
        // TODO: templatize this to improve what is passed in for trigger, cast it to int
        public void CreateTransition(txStateID from, txStateID to, Trigger trigger, TransitionCallback callback)
        {
            XUtils.Assert(!mLocked, "Modifying state machine while in use not allowed.");

            // make sure 'from' already exists
            // make sure 'from' state doesn't already have that trigger (Add() will do that)
            XState from_state, to_state;
            bool   found_from = mStates.TryGetValue(from, out from_state);
            bool   found_to   = mStates.TryGetValue(to, out to_state);

            XUtils.Assert(found_from && found_to);

            from_state.Add(trigger, to_state, callback);
        }
    /// <summary>
    /// Begins the transition animation (fade in a black background).
    /// </summary>
    /// <param name="waitTime">The time to wait before starting to fade out. Set to -1 to ignore a wait time.</param>
    public void FadeIn(TransitionCallback callback = null, float waitTime = -1)
    {
        if (anim == null)
        {
            return;
        }

        anim.SetTrigger("FadeIn");
        if (waitTime > -1)
        {
            StartCoroutine(WaitThenFadeOut(waitTime));
        }

        this.callback = callback;
    }
Пример #9
0
 public static void Start(int mode, float duration, Color color, TransitionCallback callback)
 {
     mCurrent  = mode;
     mDuration = duration;
     mTimer    = 0;
     mCallback = callback;
     mPlaying  = true;
     mColor    = color;
     //Debug.Log ("TransitionManager : start Transition mode="+mode);
     if (mCurrent == FadeIn || mCurrent == FadeOut)
     {
         //fondu à la couleur
     }
     if (mCurrent == CrossFade && mRT != null)
     {
         //CrossFade
         Camera.main.targetTexture = mRT;
         Camera.main.Render();
         Camera.main.targetTexture = null;
     }
 }
Пример #10
0
 public State(UpdateCallback onUpdate = null, TransitionCallback onEnter = null, TransitionCallback onExit = null)
 {
     this.OnUpdate = onUpdate;
     this.OnEnter  = onEnter;
     this.OnExit   = onExit;
 }
Пример #11
0
 public EpsilonState(TransitionCallback callback, FSM.State nextState)
 {
     OnEnter       = callback;
     NextState     = nextState;
     this.OnUpdate = UpdateEpsilonState;
 }
Пример #12
0
        public void AddTransitionCallback(TransitionCallback <TState> method)
        {
            var aci = new TransitionCallbackInvoker <TState>(method);

            _transitCallbacks.Add(aci);
        }
Пример #13
0
 public void CallOnAnyStateChange(TransitionCallback callback)
 {
     onAnyChange += callback;
 }
Пример #14
0
 public TransitionCallbackInvoker(TransitionCallback <TState> callback)
 {
     Callback = callback;
 }
Пример #15
0
 // Sets the callback for transition finish.
 public Fader SetTransitionCallback(TransitionCallback finishCallback)
 {
     m_TransitionFinishCb = finishCallback;
     return(this);
 }
Пример #16
0
 public XTransition(XState to_state, TransitionCallback callback)
 {
     mToState            = to_state;
     mTransitionCallback = callback;
 }
Пример #17
0
 public ShipScene OnGoToWater(TransitionCallback onGoToWaterCallback)
 {
     this.onGoToWaterCallback = onGoToWaterCallback;
     return(this);
 }
Пример #18
0
 public WorldScene OnGetIntoShip(TransitionCallback onGetIntoShipCallback)
 {
     this.onGetIntoShipCallback = onGetIntoShipCallback;
     return(this);
 }