Пример #1
0
        //---------------------------------------------------------------------
        // 客户端提交自动发炮,需要广播给客户端
        void _c2sAutoFire(List <string> vec_param)
        {
            // 解析数据
            int  index           = 0;
            uint et_player_rpcid = uint.Parse(vec_param[++index]);
            int  bullet_count    = int.Parse(vec_param[++index]);

            Queue <_tBullet> que_bullet = new Queue <_tBullet>();

            for (int i = 0; i < bullet_count; ++i)
            {
                _tBullet bullet;
                bullet.bullet_objid      = int.Parse(vec_param[++index]);
                bullet.turret_angle      = float.Parse(vec_param[++index]);
                bullet.turret_rate       = int.Parse(vec_param[++index]);
                bullet.locked_fish_objid = int.Parse(vec_param[++index]);
                que_bullet.Enqueue(bullet);
            }

            // 处理请求
            CLogicTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.c2sAutoFire(que_bullet);
            }
        }
Пример #2
0
        //---------------------------------------------------------------------
        void autoFire()
        {
            float turret_angle = mAutoFireTargetAngle;

            if (mIsLock && mAttentionFireFish != null)
            {
                turret_angle = getTurretAngle(mAttentionFireFish.Position);
            }

            _tBullet bullet;

            bullet.bullet_objid      = ++mBulletObjId;
            bullet.turret_angle      = turret_angle;
            bullet.turret_rate       = mTurret.getTurretRate();
            bullet.locked_fish_objid = mTurret.getLockFishObjId();
            Queue <_tBullet> bullet_queue = new Queue <_tBullet>();

            bullet_queue.Enqueue(bullet);
            mTurret.c2sAutoFire(bullet_queue);
        }