//--------------------------------------------------------------------- void _initBaseFishLordMgr(List <JsonPacket> json_packet_list, List <RouteJsonPacket> route_json_packet_list) { ParticleSystemFactory fish_lord_factory = new ParticleSystemFactory(); // 发射器工厂 fish_lord_factory.regGeneratorFactory(new DivergencePointGeneratorFactory()); fish_lord_factory.regGeneratorFactory(new LineGeneratorFactory()); fish_lord_factory.regGeneratorFactory(new CircleGeneratorFactory()); fish_lord_factory.regGeneratorFactory(new IntervalDivergenceGeneratorFactory()); fish_lord_factory.regGeneratorFactory(new RoundCircleGeneratorFactory()); fish_lord_factory.regGeneratorFactory(new NormalGeneratorFactory()); fish_lord_factory.regGeneratorFactory(new RedFishGeneratorFactory()); fish_lord_factory.regGeneratorFactory(new FixGeneratorFactory()); // 影响器工厂 fish_lord_factory.regAffectorFactory(new StopAffectorFactory()); fish_lord_factory.regAffectorFactory(new StartMoveAffectorFactory()); fish_lord_factory.regAffectorFactory(new AngleSpeedAffectorFactory()); mBaseFishLordMgr = new BaseFishLordMgr(new LogicFishFactory(mScene), fish_lord_factory); mBaseFishLordMgr.create(json_packet_list, route_json_packet_list); mLogicParticleSystemOuter = new LogicParticleSystemOuter(); mLogicParticleSystemOuter.create(mScene, mBaseFishLordMgr); }
//--------------------------------------------------------------------- public void destroy() { if (mEntityFactory != null) { mEntityFactory = null; } if (mParticleSystemDataPrototype != null) { mParticleSystemDataPrototype = null; } if (mRouteObjectMgr != null) { mRouteObjectMgr = null; } if (mParticleSystemFactory != null) { mParticleSystemFactory.destroy(); mParticleSystemFactory = null; } if (mParticleSystemKeeper != null) { mParticleSystemKeeper.destroy(); mParticleSystemKeeper = null; } if (mBaseEntityKeeper != null) { mBaseEntityKeeper.destroy(); mBaseEntityKeeper = null; } }
//--------------------------------------------------------------------- public ParticleSystemDataPrototype(List <JsonPacket> json_packet_list, ParticleSystemFactory factory) { mParticleSystemFactory = factory; foreach (var json_packet in json_packet_list) { // 根据Json字符串来生成BaseFishLordData BaseFishLordDataJson fish_lord_json = BaseJsonSerializer.deserialize <BaseFishLordDataJson>(json_packet.JsonString); EntityParticleSystemData fish_lord = new EntityParticleSystemData(); // 根据Json字符串来生成 fish_lord.mFishLordCommonData = BaseJsonSerializer.deserialize <FishLordCommonData> (fish_lord_json.mFishLordCommonDataString); // 根据Json字符串来生成BaseGeneratorData foreach (var it in fish_lord_json.mListBaseGenerator) { EntityGeneratorData generator_data = mParticleSystemFactory.buildGeneratorData(it); if (generator_data == null) { continue; } fish_lord.mListBaseGenerator.Add(generator_data); } // 根据Json字符串来生成BaseAffectorData foreach (var it in fish_lord_json.mListBaseAffector) { EntityAffectorData affector_data = mParticleSystemFactory.buildAffectorData(it); if (affector_data == null) { continue; } fish_lord.mListBaseAffector.Add(affector_data); } // 读出特效发射器和影响器的映射表。 fish_lord.mGeneratorAffectorMap = BaseJsonSerializer.deserialize <List <GeneratorAffectorkeyValuePair> > (fish_lord_json.mGeneratorAffectorMapString); mDicBaseFishLordDataPrototype.Add(json_packet.FileName.Substring(json_packet.FileName.LastIndexOf("/") + 1), fish_lord); } }
//--------------------------------------------------------------------- void _initBaseFishLordMgr(List <JsonPacket> json_packet_list, List <RouteJsonPacket> route_json_packet_list) { ParticleSystemFactory entity_particle_system_factory = new ParticleSystemFactory(); // 发射器工厂 entity_particle_system_factory.regGeneratorFactory(new DivergencePointGeneratorFactory()); entity_particle_system_factory.regGeneratorFactory(new LineGeneratorFactory()); entity_particle_system_factory.regGeneratorFactory(new CircleGeneratorFactory()); entity_particle_system_factory.regGeneratorFactory(new IntervalDivergenceGeneratorFactory()); entity_particle_system_factory.regGeneratorFactory(new RoundCircleGeneratorFactory()); entity_particle_system_factory.regGeneratorFactory(new NormalGeneratorFactory()); entity_particle_system_factory.regGeneratorFactory(new RedFishGeneratorFactory()); entity_particle_system_factory.regGeneratorFactory(new FixGeneratorFactory()); // 影响器工厂 entity_particle_system_factory.regAffectorFactory(new StopAffectorFactory()); entity_particle_system_factory.regAffectorFactory(new StartMoveAffectorFactory()); entity_particle_system_factory.regAffectorFactory(new AngleSpeedAffectorFactory()); mBaseFishLordMgr = new BaseFishLordMgr(new CRenderFishFactory(mScene), entity_particle_system_factory); mBaseFishLordMgr.create(json_packet_list, route_json_packet_list); }
//--------------------------------------------------------------------- public BaseFishLordMgr(BaseEntityFactory factory, ParticleSystemFactory fish_lord_factory) { mEntityFactory = factory; mParticleSystemFactory = fish_lord_factory; }