Ejemplo n.º 1
0
 public void Update()
 {
     this.m_Current = m_Buffs.First;
     //轮询链表
     while (this.m_Current != null)
     {
         ABuffSystemBase aBuff = this.m_Current.Value;
         if (aBuff.BuffState == BuffState.Waiting)
         {
             aBuff.OnExecute();
         }
         else if (aBuff.BuffState == BuffState.Running)
         {
             aBuff.OnUpdate();
             this.m_Current = this.m_Current.Next;
         }
         else
         {
             aBuff.OnFinished();
             this.m_Next = this.m_Current.Next;
             m_Buffs.Remove(this.m_Current);
             m_BuffsForFind_BuffWorkType.Remove(this.m_Current.Value.BuffData.BuffWorkType);
             this.m_BuffsForFind_BuffId.Remove(this.m_Current.Value.BuffData.BuffId);
             // Log.Info(
             //     $"移除一个Buff,Id为{this.m_Current.Value.BuffData.BuffId},BuffManager是否还有?:{this.FindBuffById(this.m_Current.Value.BuffData.BuffId)}");
             this.m_Current = this.m_Next;
         }
     }
 }
Ejemplo n.º 2
0
        public void Update()
        {
            //把Buff从临时列表加入到正式列表
            foreach (var tempBuff in this.TempBuffsToBeAdded)
            {
                this.AddBuff2Real(tempBuff.Value);
            }

            this.TempBuffsToBeAdded.Clear();

            this.m_Current = m_Buffs.First;
            //轮询链表
            while (this.m_Current != null)
            {
                ABuffSystemBase aBuff = this.m_Current.Value;
                if (aBuff.BuffState == BuffState.Waiting)
                {
                    aBuff.OnExecute();
                }
                else if (aBuff.BuffState == BuffState.Running)
                {
                    aBuff.OnUpdate();
                    this.m_Current = this.m_Current.Next;
                }
                else
                {
                    aBuff.OnFinished();
                    this.m_Next = this.m_Current.Next;
                    m_Buffs.Remove(this.m_Current);
                    m_BuffsForFind_BuffWorkType.Remove(this.m_Current.Value.BuffData.BuffWorkType);
                    this.m_BuffsForFind_BuffId.Remove(this.m_Current.Value.BuffData.BuffId);
                    // Log.Info(
                    //     $"移除一个Buff,Id为{this.m_Current.Value.BuffData.BuffId},BuffManager是否还有?:{this.FindBuffById(this.m_Current.Value.BuffData.BuffId)}");
                    this.m_Current = this.m_Next;
                }
            }
        }