public void AddAgent(RTSAgent agent) { ushort localID = GenerateLocalID(); LocalAgents[localID] = agent; LocalAgentActive[localID] = true; ushort globalID = GenerateGlobalID(); GlobalAgentActive[globalID] = true; GlobalAgents[globalID] = agent; agent.InitializeController(this, localID, globalID); }
public static void ChangeController(RTSAgent 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(); } } }