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


C# IAgent.GetType方法代码示例

本文整理汇总了C#中IAgent.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IAgent.GetType方法的具体用法?C# IAgent.GetType怎么用?C# IAgent.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAgent的用法示例。


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

示例1: AddAgent

		/** Add a previously removed agent to the simulation.
		  * An agent can only be in one simulation at a time, any attempt to add an agent to two simulations
		  * or multiple times to the same simulation will result in an exception being thrown.
		  * 
		  * \see RemoveAgent
		  */
		public IAgent AddAgent (IAgent agent) {
			if (agent == null) throw new System.ArgumentNullException ("Agent must not be null");
			
			Agent agentReal = agent as Agent;
			if (agentReal == null) throw new System.ArgumentException ("The agent must be of type Agent. Agent was of type "+agent.GetType ());
			
			
			if (agentReal.simulator != null && agentReal.simulator == this) throw new System.ArgumentException ("The agent is already in the simulation");
			else if (agentReal.simulator != null) throw new System.ArgumentException ("The agent is already added to another simulation");
			agentReal.simulator = this;
			
			//Don't interfere with ongoing calculations
			if (Multithreading && doubleBuffering) for (int j=0;j<workers.Length;j++) workers[j].WaitOne();
			
			agents.Add (agentReal);

			
			return agent;
		}
开发者ID:SpacesAdventure,项目名称:Kio-2,代码行数:25,代码来源:RVOCoreSimulator.cs

示例2: RemoveAgent

		/** Removes a specified agent from this simulation.
		 * The agent can be added again later by using AddAgent.
		 * 
		 * \see AddAgent(IAgent)
		 * \see ClearAgents
		 */
		public void RemoveAgent (IAgent agent) {
			if (agent == null) throw new System.ArgumentNullException ("Agent must not be null");
			
			Agent agentReal = agent as Agent;
			if (agentReal == null) throw new System.ArgumentException ("The agent must be of type Agent. Agent was of type "+agent.GetType ());
			
			if (agentReal.simulator != this) throw new System.ArgumentException ("The agent is not added to this simulation");
			
			//Don't interfere with ongoing calculations
			if (Multithreading && doubleBuffering) for (int j=0;j<workers.Length;j++) workers[j].WaitOne();
			
			agentReal.simulator = null;
			
			if (!agents.Remove (agentReal)) {
				throw new System.ArgumentException ("Critical Bug! This should not happen. Please report this.");
			}
		}
开发者ID:SpacesAdventure,项目名称:Kio-2,代码行数:23,代码来源:RVOCoreSimulator.cs

示例3: RemoveAgent

 public void RemoveAgent(IAgent agent)
 {
     if (agent == null)
     {
         throw new ArgumentNullException("Agent must not be null");
     }
     Agent agent2 = agent as Agent;
     if (agent2 == null)
     {
         throw new ArgumentException("The agent must be of type Agent. Agent was of type " + agent.GetType());
     }
     if (agent2.simulator != this)
     {
         throw new ArgumentException("The agent is not added to this simulation");
     }
     if (this.Multithreading && this.doubleBuffering)
     {
         for (int i = 0; i < this.workers.Length; i++)
         {
             this.workers[i].WaitOne();
         }
     }
     agent2.simulator = null;
     if (!this.agents.Remove(agent2))
     {
         throw new ArgumentException("Critical Bug! This should not happen. Please report this.");
     }
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:28,代码来源:Simulator.cs

示例4: AddAgent

 public IAgent AddAgent(IAgent agent)
 {
     if (agent == null)
     {
         throw new ArgumentNullException("Agent must not be null");
     }
     Agent agent2 = agent as Agent;
     if (agent2 == null)
     {
         throw new ArgumentException("The agent must be of type Agent. Agent was of type " + agent.GetType());
     }
     if (agent2.simulator != null && agent2.simulator == this)
     {
         throw new ArgumentException("The agent is already in the simulation");
     }
     if (agent2.simulator != null)
     {
         throw new ArgumentException("The agent is already added to another simulation");
     }
     agent2.simulator = this;
     if (this.Multithreading && this.doubleBuffering)
     {
         for (int i = 0; i < this.workers.Length; i++)
         {
             this.workers[i].WaitOne();
         }
     }
     this.agents.Add(agent2);
     return agent;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:30,代码来源:Simulator.cs

示例5: Reload

        //[PersistenceConversation(ConversationEndMode = EndMode.CommitAndContinue)]
        //public void ManuallyUpdateSchedule()
        //{
        //    TermAlteringListener.Manually();
        //}

        public void Reload(ref IAgent agent)
        {
            _timeBoxRepository.Detach(agent.Schedule);
            var reloadAgent = _timeBoxRepository.GetAgent(agent.LaborRule, agent.GetType()).TransferPropertiesFrom(agent);

            agent = reloadAgent;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:13,代码来源:ShiftDispatcherModel.cs

示例6: AgentInfo

		public AgentInfo(IAgent agent) : this() {
			this.Type = agent.GetType();
		}
开发者ID:TenCoKaciStromy,项目名称:TcKs.Gr1dRuntime,代码行数:3,代码来源:AgentInfo.cs

示例7: AgentUpdateInfo

		public AgentUpdateInfo(IAgent agent) : base(agent) {
			this.Type = agent.GetType();this.EffectsPreviousList = new List<AgentEffect>();
		}
开发者ID:TenCoKaciStromy,项目名称:TcKs.Gr1dRuntime,代码行数:3,代码来源:AgentUpdateInfo.cs


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