Esempio n. 1
0
        //-------------------------------------------------------------------------
        void _updateBullet(float elapsed_tm)
        {
            // 销毁可以销毁的子弹
            foreach (var i in mMapSignDestroyBullet)
            {
                if (mMapBullet.ContainsKey(i.Key))
                {
                    Dictionary <int, CRenderBullet> m = mMapBullet[i.Key];
                    List <int> l = i.Value;
                    foreach (var j in l)
                    {
                        if (m.ContainsKey(j))
                        {
                            m[j].Dispose();
                            m.Remove(j);
                        }
                    }
                }
            }
            mMapSignDestroyBullet.Clear();

            // 更新所有子弹
            foreach (var i in mMapBullet)
            {
                Dictionary <int, CRenderBullet> m = i.Value;
                //foreach (var j in m)
                //{
                //    j.Value.update(elapsed_tm);
                //}
                if (m.Count == 0 && !mScene.isExistPlayer(i.Key))
                {
                    mListCanDeleteKeyFromMapBullet.Add(i.Key);
                }
            }

            // 移除已经离开玩家并且该玩家所有子弹都消失了的pair
            foreach (var i in mListCanDeleteKeyFromMapBullet)
            {
                mMapBullet.Remove(i);
            }
            mListCanDeleteKeyFromMapBullet.Clear();
        }