Exemplo n.º 1
0
        //---------------------------------------------------------------------
        void longFire(float elapsed_tm)
        {
            mfTotalSecond += elapsed_tm;

            if (mfTotalSecond - mfLastFireSecond > mfFireTimeSpan)
            {
                mfLastFireSecond = mfTotalSecond;

                float random = getRandom01();
                if (random < 0.1f)
                {
                    mTurret.c2sEndLongpress();
                    change2observeState();
                }

                int cur_gold = mScene.getListener().onLogicSceneGetPlayerGold(mTurret.getScenePlayerInfo().et_player_rpcid);
                if (cur_gold < mTurret.getTurretRate())
                {
                    mTurret.c2sEndLongpress();
                    change2observeState();
                    return;
                }
                else
                {
                    autoFire();
                }
            }
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------
        // 客户端提交结束长按状态,需要广播给客户端
        void _c2sEndLongpress(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.c2sEndLongpress();
            }
        }