/// <summary> /// 根据标签筛选信息 /// </summary> /// <param name="Tag">Tag标签</param> /// <returns>返回筛选出的信息</returns> public CmpMessage[] SelectMessages(int Tag , bool deleteDatas = true) { foreach (CmpMessage msg in Messages) { Buffers.Add(msg); } int count = Buffers.Count; CmpMessage[] msgs = new CmpMessage[count]; for (int i = 0; i < count; i++) { msgs[i] = Buffers[i]; //如果需要删除读取过的信息,则从缓冲区删除[当信息种类很多的时候能有效提高效率] if (deleteDatas) { Messages.Remove(Buffers[i]); } } Buffers.Clear(); return msgs; }
/// <summary> /// 根据标签筛选信息 /// </summary> /// <param name="Tag">Tag标签</param> /// <returns>返回筛选出的信息</returns> public CmpMessage[] SelectMessages(int Tag, bool deleteDatas = true) { foreach (CmpMessage msg in Messages) { Buffers.Add(msg); } int count = Buffers.Count; CmpMessage[] msgs = new CmpMessage[count]; for (int i = 0; i < count; i++) { msgs[i] = Buffers[i]; //如果需要删除读取过的信息,则从缓冲区删除[当信息种类很多的时候能有效提高效率] if (deleteDatas) { Messages.Remove(Buffers[i]); } } Buffers.Clear(); return(msgs); }
protected float speed = 50; //子弹的飞行速度(默认) #endregion Fields #region Methods /// <summary> /// 获得一种信息,并及时的执行任务 /// </summary> /// <param name="msg">组件之间的传递信息</param> public virtual void AcceptMessage(CmpMessage msg) { ComponentMessages.Add(msg); }
/// <summary> /// 获得信息 /// </summary> /// <param name="msg"></param> public void AcceptMessage(CmpMessage msg) { Messages.Add(msg); }
/// <summary> /// 获得一种信息,并及时的执行任务 /// </summary> /// <param name="msg">组件之间的传递信息</param> public virtual void AcceptMessage(CmpMessage msg) { ComponentMessages.Add(msg); }