protected static void Init_(int contextId, Agent pAgent, int priority, string agentInstanceName) { pAgent.m_contextId = contextId; pAgent.m_id = ms_agent_index++; pAgent.m_priority = priority; pAgent.SetName(agentInstanceName); pAgent.InitVariableRegistry(); World objA = Context.GetContext(contextId).GetWorld(true); if (!object.ReferenceEquals(objA, null) && !object.ReferenceEquals(objA, pAgent)) { objA.AddAgent(pAgent); } pAgent.SubsribeToNetwork(); }