Esempio n. 1
0
        public void AddAgent(LSAgent agent)
        {
            ushort localID = GenerateLocalID();

            LocalAgents[localID]      = agent;
            LocalAgentActive[localID] = true;

            ushort globalID = GenerateGlobalID();

            GlobalAgentActive[globalID] = true;
            GlobalAgents[globalID]      = agent;

            agent.InitializeController(this, localID, globalID);
        }
Esempio n. 2
0
        public static void ChangeController(LSAgent agent, AgentController newCont)
        {
            AgentController leController = agent.Controller;

            if (leController != null)
            {
                leController.LocalAgentActive[agent.LocalID] = false;
                GlobalAgentActive[agent.GlobalID]            = false;
                leController.OpenLocalIDs.Add(agent.LocalID);
                OpenGlobalIDs.Add(agent.GlobalID);

                if (newCont == null)
                {
                    agent.InitializeController(null, 0, 0);
                }
                else
                {
                    agent.Influencer.Deactivate();

                    newCont.AddAgent(agent);
                    agent.Influencer.Initialize();
                }
            }
        }