//--------------------------------------------------------------------- public GeneratorAndAffectorKeeper( BaseFishLordMgr fish_lord_mgr, EntityParticleSystem fish_lord, BaseEntityFactory factory, EntityParticleSystemData fish_lord_data, int fish_begin_id, List <string> server_param, RouteObjectMgr route_object_mgr) { mFishLordMgr = fish_lord_mgr; int fish_id = fish_begin_id; int generator_id = 0; foreach (var it in fish_lord_data.mListBaseGenerator) { EntityGenerator generator = mFishLordMgr.buildGenerator(it, server_param, route_object_mgr); generator.setBaseFishLord(fish_lord); generator.setBaseGeneratorId(generator_id); generator.setBeginFishId(fish_id); fish_id += it.getBaseEntityCount(); if (generator == null) { continue; } mListBaseGenerator.Add(generator); generator_id++; } foreach (var it in fish_lord_data.mListBaseAffector) { EntityAffector affector = mFishLordMgr.buildAffector(it); if (affector == null) { continue; } affector.setBaseFishLord(fish_lord); mListBaseAffector.Add(affector); } foreach (var it in fish_lord_data.mGeneratorAffectorMap) { if (mListBaseAffector.Count > it.mAffectorIndex && mListBaseGenerator.Count > it.mGeneratorIndex) { mListBaseAffector[it.mAffectorIndex].setGeneratorId(it.mGeneratorIndex); } } foreach (var it in mListBaseGenerator) { it.create(); } }
//--------------------------------------------------------------------- public void update(float elapsed_tm) { foreach (var it in mEntityParticleSystem) { it.update(elapsed_tm); if (it.Done) { mQueEntityParticleSystemDestroy.Enqueue(it); } } while (mQueEntityParticleSystemDestroy.Count > 0) { EntityParticleSystem ps = mQueEntityParticleSystemDestroy.Dequeue(); mEntityParticleSystem.Remove(ps); ps.destroy(); } }
//--------------------------------------------------------------------- public void addParticleSystem(EntityParticleSystem fish_lord) { mEntityParticleSystem.Add(fish_lord); }
//--------------------------------------------------------------------- public void setBaseFishLord(EntityParticleSystem fish_lord) { mEntityParticleSystem = fish_lord; }