//------------------------------------------------------------------------- // 服务端广播消息:鱼死亡 public void s2allcFishDie(uint et_player_rpcid, int total_score, int bullet_objid, int fish_objid, int effect_fish_vibid, int current_rate) { CRenderFish fish = (CRenderFish)mBaseFishLordMgr.findBaseEntity(fish_objid); if (fish != null) { //fish.signDestroy(); // 销毁鱼 fish.dieWithTotalScore(et_player_rpcid, total_score); // 更新金币和筹码 CRenderTurret turret = mScene.getTurret(et_player_rpcid); if (turret != null) { //turret.setPlayerGold(gold); TbDataFish fish_data = EbDataMgr.Instance.getData <TbDataFish>(fish.FishVibId); if (fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.Turnplate) { //turret.displayScoreTurnplate(total_score, fish_data.TurnplateParticle.Data); } else if (fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.Chips) { turret.displayChips(total_score); } else if (fish_data.FishDisplayScoreType == TbDataFish._eDisplayScoreType.ChipsAndTurnplate) { turret.displayChips(total_score); //turret.displayScoreTurnplate(total_score, fish_data.TurnplateParticle.Data); } } } // 销毁子弹 if (mMapBullet.ContainsKey(et_player_rpcid)) { Dictionary <int, CRenderBullet> m = mMapBullet[et_player_rpcid]; if (!m.ContainsKey(bullet_objid)) { return; } m[bullet_objid].signDestroy(); } else { //Debug.LogError("CRenderLevel::s2allcFishDie() not found player_id=" + player_id + " when signdestroy bullet"); } }
//------------------------------------------------------------------------- void _die(uint et_player_rpcid, int total_score) { if (mIsDie) { return; } mPlayerId = et_player_rpcid; mTotalScore = total_score; mSpriteFreeFromTimeFactor = true; // 播放鱼死亡时候的粒子特效 mFishParticleMgr.fishDie(); // 显示掉落金币数字 if (total_score > 0) { CSpriteFishDieScore score = CSpriteFishDieScore.getScore(mScene, mMassEntity.Position, total_score, 2);//待整理 } // 播放鱼死亡时触发的特效 foreach (var it in mVibFish.Effects) { int vib_compose_id = it.Id; if (vib_compose_id <= 0) { continue; } Dictionary <string, object> param = new Dictionary <string, object>(); param.Add("SourcePosition", mMassEntity.Position); param.Add("SourceAngle", 0f); param.Add("PlayerId", et_player_rpcid); CRenderTurret turret = mScene.getTurret(et_player_rpcid); if (turret != null) { param.Add("DestPosition", turret.getTurretPos()); } else { param.Add("DestPosition", mMassEntity.Position); } param.Add("IsFishDie", true); mScene.addEffect(vib_compose_id, param, EffectTypeEnum.Client); } // 处理SpriteFish mFishStopMove = true; if (mISpriteFish != null) { mISpriteFish.playDieAnimation(); } if (mVibFish.Red == TbDataFish.IsRed.YES) { mScene.getLevel().addRedFishPosition(mFishObjId, Position); } signDie(); }
//------------------------------------------------------------------------- void _s2allcTurretRate(List <string> vec_param) { if (!mScene.isInit()) { return; } int index = 0; uint et_player_rpcid = uint.Parse(vec_param[++index]); int turret_rate = int.Parse(vec_param[++index]); CRenderTurret turret = mScene.getTurret(et_player_rpcid); if (turret != null) { turret.s2allcTurretRate(turret_rate); } }
//------------------------------------------------------------------------- public void create(uint et_player_rpcid, int bullet_objid, int bullet_vibid, float bullet_speed, int locked_fish_obj_id, EbVector3 turret_pos, float turret_angle, TbDataParticle hit_particle) { // vib mPlayerId = et_player_rpcid; mVibBullet = EbDataMgr.Instance.getData <TbDataBullet>(bullet_vibid); mPos = turret_pos; mfAngle = turret_angle; mBulletObjId = bullet_objid; mLockedFishObjid = locked_fish_obj_id; //mfBulletSpeed = mVibBullet.Speed; mfBulletSpeed = bullet_speed; // sprite bullet CRenderTurret turret = mScene.getTurret(mPlayerId); int turret_id = turret.getTurretId(); string bullet_anim = mVibBullet.Bullet0Animation; if (turret.isPower()) { bullet_anim = mVibBullet.ColorBulletAnimation; } else { switch (turret_id) { case 1: bullet_anim = mVibBullet.Bullet1Animation; break; case 2: bullet_anim = mVibBullet.Bullet2Animation; break; case 3: bullet_anim = mVibBullet.Bullet3Animation; break; case 4: bullet_anim = mVibBullet.Bullet4Animation; break; case 5: bullet_anim = mVibBullet.Bullet5Animation; break; case 6: bullet_anim = mVibBullet.Bullet6Animation; break; } } mBulletAnim = bullet_anim; mSpriteBullet = new CSpriteBullet(); mSpriteBullet.create(mScene, this, mBulletAnim, hit_particle); mSpriteBullet.setTrigger(true, 200); mSpriteBullet.setPosition(mPos); mSpriteBullet.setDirection(mfAngle); mSpriteBullet.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.Bullet)); mSpriteBullet.setScale((float)mVibBullet.BulletHeight / (float)mVibBullet.BulletPixelHeight); mScene.getLevel().addBullet(this); }