예제 #1
0
파일: Action.cs 프로젝트: ashr/posh-sharp
 /// <summary>
 /// Picks the given action from the given agent.
 ///
 /// The method uses the agent's behaviour dictionary to get the
 /// action method.
 ///
 /// The log domain is set to "[AgentId].Action.[action_name]".
 ///
 /// The action name is set to "[BehaviourName].[action_name]".
 /// </summary>
 /// <param name="agent">The agent that can perform the action.</param>
 /// <param name="actionName">The name of the action</param>
 public POSHAction(Agent agent, string actionName)
     : base(string.Format("Action.{0}", actionName), agent)
 {
     behaviourDict = agent.getBehaviourDict();
     action        = behaviourDict.getAction(actionName);
     behaviour     = behaviourDict.getActionBehaviour(actionName);
     name          = string.Format("{0}.{1}", behaviour.GetName(), actionName);
     log.Debug("Created");
 }
예제 #2
0
 /// <summary>
 /// Picks the given action from the given agent.
 /// 
 /// The method uses the agent's behaviour dictionary to get the
 /// action method.
 /// 
 /// The log domain is set to "[AgentId].Action.[action_name]".
 /// 
 /// The action name is set to "[BehaviourName].[action_name]".
 /// </summary>
 /// <param name="agent">The agent that can perform the action.</param>
 /// <param name="actionName">The name of the action</param>
 public POSHAction(Agent agent, string actionName)
     : base(string.Format("Action.{0}",actionName),agent)
 {
     behaviourDict = agent.getBehaviourDict();
     action = behaviourDict.getAction(actionName);
     behaviour = behaviourDict.getActionBehaviour(actionName);
     name = string.Format("{0}.{1}",behaviour.GetName(),actionName);
     log.Debug("Created");
 }
예제 #3
0
        /// <summary>
        /// Picks the given action from the given agent.
        /// 
        /// The method uses the agent's behaviour dictionary to get the
        /// action method.
        /// 
        /// The log domain is set to "[AgentId].Action.[action_name]".
        /// 
        /// The action name is set to "[BehaviourName].[action_name]".
        /// </summary>
        /// <param name="agent">The agent that can perform the action.</param>
        /// <param name="actionName">The name of the action</param>
        public POSHAction(Agent agent, string actionName)
            : base(string.Format("Action.{0}",actionName),agent)
        {
            behaviourDict = agent.getBehaviourDict();
            action = behaviourDict.getAction(actionName);
            behaviour = behaviourDict.getActionBehaviour(actionName);
            name = string.Format("{0}.{1}",behaviour.GetName(),actionName);
            log.Debug("Created");

            //hook up to a listener for fire events
            if (agent.HasListenerForTyp(EventType.Fire))
                agent.SubscribeToListeners(this, EventType.Fire);
        }
예제 #4
0
파일: Action.cs 프로젝트: ashr/posh-sharp
        /// <summary>
        /// Picks the given action from the given agent.
        ///
        /// The method uses the agent's behaviour dictionary to get the
        /// action method.
        ///
        /// The log domain is set to "[AgentId].Action.[action_name]".
        ///
        /// The action name is set to "[BehaviourName].[action_name]".
        /// </summary>
        /// <param name="agent">The agent that can perform the action.</param>
        /// <param name="actionName">The name of the action</param>
        public POSHAction(Agent agent, string actionName)
            : base(string.Format("Action.{0}", actionName), agent)
        {
            behaviourDict = agent.getBehaviourDict();
            action        = behaviourDict.getAction(actionName);
            behaviour     = behaviourDict.getActionBehaviour(actionName);
            name          = string.Format("{0}.{1}", behaviour.GetName(), actionName);
            log.Debug("Created");

            //hook up to a listener for fire events
            if (agent.HasListenerForTyp(EventType.Fire))
            {
                agent.SubscribeToListeners(this, EventType.Fire);
            }
        }