当前位置: 首页>>代码示例>>C#>>正文


C# Agent类代码示例

本文整理汇总了C#中Agent的典型用法代码示例。如果您正苦于以下问题:C# Agent类的具体用法?C# Agent怎么用?C# Agent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Agent类属于命名空间,在下文中一共展示了Agent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestAccess

        public void TestAccess()
        {
            var agent = new Agent().Face<ITestAgent>();
            agent["Access"] = new Bin<bool>();

            agent.Init("stream", typeof(Stream), false);
            try
            {
                var f = agent["stream"].First;
            }
            catch (Exception e)
            {
                Assert.Inconclusive(e.ToString());
            }

            Assert.AreEqual(false, agent["Access"].First);

            Assert.AreEqual(1, agent["Access"].Count);

            agent.Init("Secure", true);
            agent["Secure"].Add(true);

            Assert.AreEqual(true, agent["Secure"][1]);
            Assert.AreEqual(2, agent["Secure"].Count);
        }
开发者ID:velcrome,项目名称:vvvv-Game,代码行数:25,代码来源:FaceAgentTest.cs

示例2: AStar

 public AStar(Agent a)
 {
     agent = a;
     findTarget = false;
     currGoal = agent.transform.position;
     hasPath = false;
 }
开发者ID:jessmay,项目名称:oil-penguins,代码行数:7,代码来源:AStar.cs

示例3: DayStart

 public override void DayStart()
 {
     declaredPlanningVoteAgent = null;
     planningVoteAgent = null;
     SetPlanningVoteAgent();
     readTalkListNum = 0;
 }
开发者ID:AIWolfSharp,项目名称:AIWolfSharp,代码行数:7,代码来源:SampleBodyguard.cs

示例4: TestInt

        public void TestInt()
        {
            var agent = new Agent();

            agent.Init("Test", 1);
            Assert.AreEqual(1, agent["Test"][0], "Vanilla Agent int initialisation");

            agent["Test"].Add(2);
            Assert.AreEqual(2, agent["Test"][1], "Vanilla Agent int append");

            var l = new List<int> { 3, 4 };
            agent["Test"].Add(l);

            Assert.AreEqual(3, agent["Test"][2], "Vanilla Agent int add IEnumeration");
            Assert.AreEqual(4, agent["Test"][3], "Vanilla Agent int add IEnumeration");

            agent["Test"].First =0;
            Assert.AreEqual(0, agent["Test"][0], "Vanilla Agent int set First");
            Assert.AreEqual(0, agent["Test"].First, "Vanilla Agent int get First");

            agent["Test"].AssignFrom(l);
            Assert.AreEqual(3, agent["Test"][0], "Vanilla Agent int assign IEnumeration");
            Assert.AreEqual(4, agent["Test"][1], "Vanilla Agent int assign IEnumeration");

            Assert.AreEqual(2, agent["Test"].Count, "Vanilla Agent int Count");

            agent.Init<int>("SecondTestInt");
            agent["SecondTestInt"].Add(1);
            Assert.AreEqual(1, agent["SecondTestInt"].First);
        }
开发者ID:velcrome,项目名称:vvvv-Game,代码行数:30,代码来源:AgentTest.cs

示例5: DeregisterServiceOnTakeDown

 // Handles the messages associated with the take down of an agent, and deregisters the service on its behalf
 public static void DeregisterServiceOnTakeDown(Agent myAgent)
 {
     DFService.deregister(myAgent);
     MessageBox.Show(
         "Agent " + myAgent.getLocalName() +
         " was taken down.\r\nAn unhandled exception probably occured.");
 }
开发者ID:ablindu,项目名称:MASMA,代码行数:8,代码来源:YellowPages.cs

示例6: Insert

        public bool Insert(AirtimeBilling.Core.Entities.Agent entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("No Agent supplied");
            }

            if (entity.Id != null)
            {
                throw new ArgumentOutOfRangeException("Agent Id is not null");
            }

            try
            {
                using (var db = DbFactory.GetDataContext())
                {
                    var agent = new Agent();
                    PopulateAgentFromAgentEntity(entity, ref agent);
                    db.Agents.InsertOnSubmit(agent);
                    db.SubmitChanges();

                    entity.Inserted(agent.AgentId);
                    return true;
                }
            }
            catch (Exception ex)
            {
                LoggingUtility.LogException(ex);
            }
            return false;
        }
开发者ID:robgray,项目名称:Tucana,代码行数:31,代码来源:AgentRepository.cs

示例7: printSKB

        //Print the Social Knowledgebase
        private static void printSKB()
        {
            KB_S SKB = new KB_S();

            SocialGame girlGame = new SocialGame(new Subject(SubjectType.Girl));
            SocialGame playerGame = new SocialGame(new Subject(SubjectType.Player));

            Agent agent1 = new Agent("agent1");
            Agent agent2 = new Agent("agent2");
            Agent agent3 = new Agent("agent3");
            Agent agent4 = new Agent("agent4");

            SocialFact sf1 = new SocialFact(girlGame, agent1, agent2);
            SocialFact sf2 = new SocialFact(playerGame, agent1, agent2);
            SocialFact sf3 = new SocialFact(girlGame, agent3, agent1);

            SKB.addNewFact(sf1);
            SKB.addNewFact(sf2);
            SKB.addNewFact(sf3);

            List<SocialFact> factsByAgent = SKB.getSocialFactsByAgent(agent2);
            Console.WriteLine("FOUND: " + factsByAgent.Count + " FACTS.");

            List<SocialFact> factsByGame = SKB.getSocialFactsBySubject(new Subject(SubjectType.Girl));
            Console.WriteLine("FOUND: " + factsByGame.Count + " FACTS.");

            //SocialFact sf1 = new SocialFact()
        }
开发者ID:Kurios,项目名称:4803AIGame,代码行数:29,代码来源:KBTester.cs

示例8: InitBehavior

    //public WorldScript WorldScript;
    /*
     * CharacterScript (Me)
     *   -ActiveTask (stored as string)
     *   -TaskParameters (list / dictionary of strings)
     * WorldScript (MyWorld)
     */
    public override void InitBehavior(Agent actor)
    {
        //Find the relevant variables from the parent object.
        WorldScript ws = GameObject.Find("Root").GetComponent<WorldScript>();
        WorldGUI wGUI = GameObject.Find("Root").GetComponent<WorldGUI>();
        CharacterScript cs = this.transform.parent.GetComponent<CharacterScript>();

        if (ws == null || wGUI == null || cs == null) Debug.LogError("Error finding attached scripts during activation.");

        actor.actionContext.AddContextItem<WorldScript>("world", ws);
        actor.actionContext.AddContextItem<WorldGUI>("gui", wGUI);
        actor.actionContext.AddContextItem<CharacterScript>("character", cs);
        actor.actionContext.AddContextItem<GameObject>("moveTarget", cs.gameObject);

        #region Temp testing.
        //CharacterScript player = ws.PartyCharacter;
        //Item sword = ws.GetItemByName("Sword");
        //LocaleScript locale = ws.GetLocaleByName("Happyville");

        //Debug.Log(locale);

        //Task task = new Task("deliver", cs, player, sword, locale);
        //ws.DramaManager.EmergencyRepair(task);
        //cs.ActiveTask = task;
        #endregion
    }
开发者ID:boyangli,项目名称:UnityForgeAGA,代码行数:33,代码来源:MagicAgentActivater.cs

示例9: executeAction

        public override EnvironmentState executeAction(Agent a, Action agentAction)
        {

            if (ACTION_MOVE_RIGHT == agentAction)
            {
                envState.setAgentLocation(a, LOCATION_B);
                updatePerformanceMeasure(a, -1);
            }
            else if (ACTION_MOVE_LEFT == agentAction)
            {
                envState.setAgentLocation(a, LOCATION_A);
                updatePerformanceMeasure(a, -1);
            }
            else if (ACTION_SUCK == agentAction)
            {
                if (LocationState.Dirty == envState.getLocationState(envState
                        .getAgentLocation(a)))
                {
                    envState.setLocationState(envState.getAgentLocation(a),
                            LocationState.Clean);
                    updatePerformanceMeasure(a, 10);
                }
            }
            else if (agentAction.isNoOp())
            {
                // In the Vacuum Environment we consider things done if
                // the agent generates a NoOp.
                isDone = true;
            }

            return envState;
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:32,代码来源:VacuumEnvironment.cs

示例10: Judge

 public Judge(int day, Agent agent, Agent target, Species result)
 {
     Day = day;
     Agent = agent;
     Target = target;
     Result = result;
 }
开发者ID:AIWolfSharp,项目名称:AIWolfSharp,代码行数:7,代码来源:Judge.cs

示例11: Instantiate

 // called before loading files, otherwise, locals have been added and will be instantiated
 public void Instantiate(Agent pAgent)
 {
     foreach(Property property_ in this.m_properties.Values)
     {
         property_.Instantiate(pAgent);
     }
 }
开发者ID:githubNil,项目名称:behaviac,代码行数:8,代码来源:AgentProperties.cs

示例12: Awake

 void Awake()
 {
     agentObject = gameObject.transform.parent.gameObject;
     agentComponent = (Agent)agentObject.GetComponent("Agent");
     clan = agentComponent.GetClan();
     facts = agentComponent.GetSubsystemFacts();
 }
开发者ID:RikardGehlin,项目名称:Exjobb,代码行数:7,代码来源:ScoutSubsystem.cs

示例13: CopyTo

        public void CopyTo(Agent pAgent, Variables target)
        {
            target.m_variables.Clear();

            var e = this.m_variables.Keys.GetEnumerator();
            while (e.MoveNext())
            {
                uint id = e.Current;
                IInstantiatedVariable pVar = this.m_variables[id];
                IInstantiatedVariable pNew = pVar.clone();

                target.m_variables[id] = pNew;
            }

            if (!Object.ReferenceEquals(pAgent, null))
            {
                e = target.m_variables.Keys.GetEnumerator();
                while (e.MoveNext())
                {
                    uint id = e.Current;
                    IInstantiatedVariable pVar = this.m_variables[id];

                    pVar.CopyTo(pAgent);
                }
            }
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:26,代码来源:AgentState.cs

示例14: TestInt

        public void TestInt()
        {
            var agent = new Agent().Face<ITestAgent>(true);
            //        agent.Init("SingleInt", typeof(int));
            agent.SingleInt++;
            Assert.AreEqual(1, agent["SingleInt"].First, "Face Agent int initialisation");

            agent.TestInt = new Bin<int>(1);
            Assert.AreEqual(1, agent.TestInt[0], "Face Agent int initialisation");

            agent.TestInt.Add(2);
            Assert.AreEqual(2, agent.TestInt[1], "Face Agent int append");

            var l = new List<int> {3, 4};
            agent.TestInt.Add(l);

            Assert.AreEqual(3, agent.TestInt[2], "Face Agent int add IEnumeration");
            Assert.AreEqual(4, agent.TestInt[3], "Face Agent int add IEnumeration");

            agent.TestInt.First = 0;
            Assert.AreEqual(0, agent.TestInt[0], "Face Agent int set First");
            Assert.AreEqual(0, agent.TestInt.First, "Face Agent int get First");

            agent.TestInt.AssignFrom(l);
            Assert.AreEqual(3, agent.TestInt[0], "Face Agent int assign IEnumeration");
            Assert.AreEqual(4, agent.TestInt[1], "Face Agent int assign IEnumeration");

            Assert.AreEqual(2, agent.TestInt.Count, "Face Agent int Count");
        }
开发者ID:velcrome,项目名称:vvvv-Game,代码行数:29,代码来源:FaceAgentTest.cs

示例15: Configuration

 public Configuration()
 {
     EnvironmentSettings = new Environment();
     AgentSettings = new Agent();
     TagSettings = new Tag();
     ResourceSettings = new Resource();
 }
开发者ID:andrewanderson,项目名称:Web-Critters,代码行数:7,代码来源:Configuration.cs


注:本文中的Agent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。