コード例 #1
0
ファイル: RenderLevel.cs プロジェクト: yinlei/Fishing
        //-------------------------------------------------------------------------
        public void addBullet(CRenderBullet bullet)
        {
            if (mMapBullet.ContainsKey(bullet.getPlayerId()))
            {
                Dictionary<int, CRenderBullet> m = mMapBullet[bullet.getPlayerId()];
                if (m.ContainsKey(bullet.getBulletObjId()))
                {
                    m[bullet.getBulletObjId()].Dispose();
                    m.Remove(bullet.getBulletObjId());
                }

                m[bullet.getBulletObjId()] = bullet;
            }
            else
            {
                Dictionary<int, CRenderBullet> m = new Dictionary<int, CRenderBullet>();
                m[bullet.getBulletObjId()] = bullet;
                mMapBullet[bullet.getPlayerId()] = m;
            }
        }
コード例 #2
0
        //-------------------------------------------------------------------------
        public void addBullet(CRenderBullet bullet)
        {
            if (mMapBullet.ContainsKey(bullet.getPlayerId()))
            {
                Dictionary <int, CRenderBullet> m = mMapBullet[bullet.getPlayerId()];
                if (m.ContainsKey(bullet.getBulletObjId()))
                {
                    m[bullet.getBulletObjId()].Dispose();
                    m.Remove(bullet.getBulletObjId());
                }

                m[bullet.getBulletObjId()] = bullet;
            }
            else
            {
                Dictionary <int, CRenderBullet> m = new Dictionary <int, CRenderBullet>();
                m[bullet.getBulletObjId()]       = bullet;
                mMapBullet[bullet.getPlayerId()] = m;
            }
        }
コード例 #3
0
        //-------------------------------------------------------------------------
        void _hitFish(CRenderFish render_fish)
        {
            if (render_fish == null || render_fish.IsDie)
            {
                return;
            }

            uint et_player_rpcid = mBullet.getPlayerId();

            if (mBullet.getScene().getMyPlayerId() == et_player_rpcid)
            {
                mBullet.getScene().getProtocol().c2sFishHit(et_player_rpcid, mBullet.getBulletObjId(), render_fish.FishObjId);
            }

            mBullet.signDestroy();
            mIsSignDestroy = true;

            CRenderTurret turret = mBullet.getScene().getTurret(et_player_rpcid);

            if (turret == null)
            {
                return;
            }
            TbDataTurret vib_turret = turret.getVibTurret();

            Dictionary <string, object> map_param = new Dictionary <string, object>();

            map_param.Add("SourcePosition", getHitPosition(render_fish.Position, mBullet.getPosition()));
            map_param["NetColor"]      = mBullet.getScene().getTurret(et_player_rpcid).getTurretColor();
            map_param["PlayerId"]      = et_player_rpcid;
            map_param["BulletHitFish"] = render_fish;
            TbDataBullet buttlt_data = mBullet.getBulletData();

            mBullet.getScene().addEffect(buttlt_data.EffectCompose.Id, map_param, EffectTypeEnum.Client);

            if (!string.IsNullOrEmpty(mHitParticle.ParticlePrefabName))
            {
                StillParticle particle = mScene.getParticlemanager().newParticle(mHitParticle.ParticlePrefabName);
                particle.setPosition(getHitPosition(render_fish.Position, mBullet.getPosition()));
                particle.setLayer(mScene.getLayerAlloter().getLayer(_eLevelLayer.FishHitParticle));
            }
        }