//--------------------------------------------------------------------- void rapidFire(float elapsed_tm) { mfTotalSecond += elapsed_tm; if (mfTotalSecond - mfLastFireSecond > mfFireTimeSpan) { mfLastFireSecond = mfTotalSecond; float random = getRandom01(); if (random < 0.1f) { mTurret.c2sEndRapid(); change2observeState(); } int cur_gold = mScene.getListener().onLogicSceneGetPlayerGold(mTurret.getScenePlayerInfo().et_player_rpcid); if (cur_gold < mTurret.getTurretRate()) { mTurret.c2sEndRapid(); change2observeState(); return; } else { autoFire(); } } }
//--------------------------------------------------------------------- // 客户端提交结束极速状态,需要广播给客户端 void _c2sEndRapid(List <string> vec_param) { // 解析数据 int index = 0; uint et_player_rpcid = uint.Parse(vec_param[++index]); // 处理请求 CLogicTurret turret = mScene.getTurret(et_player_rpcid); if (turret != null) { turret.c2sEndRapid(); } }