Пример #1
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene        = scene;
            mRenderTurret = render_turret;
            mRenderTurret.getTurretId();

            _initTurretBase();
            _initTurretTop();
            _initTurretBarrel();
            _initTurretBlaze();

            _setTrigger(true);
            mTkMaterial   = GameObject.Instantiate(Resources.Load(mTkMaterialName)) as UnityEngine.Material;
            mGlowMaterial = GameObject.Instantiate(Resources.Load(mGlowMaterialName)) as UnityEngine.Material;

#if UNITY_EDITOR
            mTurretBaseSprite.gameObject.name   = "TkSpriteTurret";
            mTurretTopSprite.gameObject.name    = "TkSpriteTurret";
            mTurretBlazeSprite.gameObject.name  = "TkSpriteTurret";
            mTurretBarrelSprite.gameObject.name = "TkSpriteTurret";
#endif

            if (mRenderTurret.isMyTurret())
            {
                startGlow(5f);
            }
        }
Пример #2
0
        public LinkLockedFishFeature(CRenderScene scene, CRenderTurret turret)
        {
            mCRenderTurret = turret;
            mScene = scene;

            mLayer = mScene.getLayerAlloter().getLayer(_eLevelLayer.LinkLockedFish);

            mArrow = mScene.getRenderObjectPool().newStillSprite();
            mArrow.setScale(0.5f);
            mArrow.playAnimation("locking_line_array");
            mArrow.setColor(mCRenderTurret.getTurretColor());
            mArrow.setLayer(mLayer);

            mNumber = mScene.getRenderObjectPool().newStillSprite();
            mNumber.setScale(1f);
            mNumber.playAnimation("locking_line_target_" + mCRenderTurret.getTurretId());
            mNumber.setColor(mCRenderTurret.getTurretColor());

            mNumber.setLayer(mLayer);

            setActive(false);

            #if UNITY_EDITOR
            mArrow.gameObject.name = "TkSpriteLinkLocked_locking_line_array";
            mNumber.gameObject.name = "TkSpriteLinkLocked_locking_line_target_" + mCRenderTurret.getTurretId();
            #endif
        }
Пример #3
0
        //-------------------------------------------------------------------------
        void _s2allcAutoFire(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            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);
            }

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcAutoFire(que_bullet);
            }
        }
Пример #4
0
        public LinkLockedFishFeature(CRenderScene scene, CRenderTurret turret)
        {
            mCRenderTurret = turret;
            mScene         = scene;

            mLayer = mScene.getLayerAlloter().getLayer(_eLevelLayer.LinkLockedFish);

            mArrow = mScene.getRenderObjectPool().newStillSprite();
            mArrow.setScale(0.5f);
            mArrow.playAnimation("locking_line_array");
            mArrow.setColor(mCRenderTurret.getTurretColor());
            mArrow.setLayer(mLayer);

            mNumber = mScene.getRenderObjectPool().newStillSprite();
            mNumber.setScale(1f);
            mNumber.playAnimation("locking_line_target_" + mCRenderTurret.getTurretId());
            mNumber.setColor(mCRenderTurret.getTurretColor());

            mNumber.setLayer(mLayer);

            setActive(false);

#if UNITY_EDITOR
            mArrow.gameObject.name  = "TkSpriteLinkLocked_locking_line_array";
            mNumber.gameObject.name = "TkSpriteLinkLocked_locking_line_target_" + mCRenderTurret.getTurretId();
#endif
        }
Пример #5
0
 //-------------------------------------------------------------------------
 public CRenderBufferMgr(CRenderScene scene, CRenderTurret turret, EbVector3 position, float up_angle)
 {
     mScene      = scene;
     mTurret     = turret;
     mFisrtPoint = position;
     mUpAngle    = up_angle;
 }
Пример #6
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene         = scene;
            mCRenderTurret = render_turret;
            int turret_id = render_turret.getTurretId();

            CTurretHelper turret_helper = mScene.getTurretHelper();

            float base_angle = turret_helper.getBaseAngleByTurretId(turret_id);

            mCSpriteCounter = new CSpriteCounter(mScene,
                                                 turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().ChipsOffset),
                                                 turret_helper.getBaseAngleByTurretId(turret_id));

            mScoreTurnplate = new CSpriteScoreTurnplate(mScene, turret_helper.getPositionByOffset(turret_id,
                                                                                                  mScene.getRenderConfigure().TurretTurnplateOffset), base_angle);

            //mCSpriteScore = new CSpriteScore(mScene, turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().ChipsOffset), 0, turret_id);

            if (turret_id == 0 || turret_id == 1)
            {
                EbVector3 offset = mScene.getRenderConfigure().TurretPanelScoreOffset;
                offset.x += mScene.getRenderConfigure().UpTurretPanelScoreOffset;
                //mCSpriteScore.setDigitPosition(turret_helper.getPositionByOffset(turret_id, offset), 0);
            }
            else
            {
                //mCSpriteScore.setDigitPosition(turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().TurretPanelScoreOffset), base_angle);
            }
            //mCSpriteScore.setBgPosition(turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().TurretPanelScoreBgOffset), base_angle);
        }
Пример #7
0
 //-------------------------------------------------------------------------
 public CRenderBufferMgr(CRenderScene scene, CRenderTurret turret, EbVector3 position, float up_angle)
 {
     mScene = scene;
     mTurret = turret;
     mFisrtPoint = position;
     mUpAngle = up_angle;
 }
Пример #8
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene = scene;
            mRenderTurret = render_turret;
            mRenderTurret.getTurretId();

            _initTurretBase();
            _initTurretTop();
            _initTurretBarrel();
            _initTurretBlaze();

            _setTrigger(true);
            mTkMaterial = GameObject.Instantiate(Resources.Load(mTkMaterialName)) as UnityEngine.Material;
            mGlowMaterial = GameObject.Instantiate(Resources.Load(mGlowMaterialName)) as UnityEngine.Material;

            #if UNITY_EDITOR
            mTurretBaseSprite.gameObject.name = "TkSpriteTurret";
            mTurretTopSprite.gameObject.name = "TkSpriteTurret";
            mTurretBlazeSprite.gameObject.name = "TkSpriteTurret";
            mTurretBarrelSprite.gameObject.name = "TkSpriteTurret";
            #endif

            if (mRenderTurret.isMyTurret())
            {
                startGlow(5f);
            }
        }
Пример #9
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene = scene;
            mCRenderTurret = render_turret;
            int turret_id = render_turret.getTurretId();

            CTurretHelper turret_helper = mScene.getTurretHelper();

            float base_angle = turret_helper.getBaseAngleByTurretId(turret_id);

            mCSpriteCounter = new CSpriteCounter(mScene,
                turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().ChipsOffset),
                turret_helper.getBaseAngleByTurretId(turret_id));

            mScoreTurnplate = new CSpriteScoreTurnplate(mScene, turret_helper.getPositionByOffset(turret_id,
                mScene.getRenderConfigure().TurretTurnplateOffset), base_angle);

            //mCSpriteScore = new CSpriteScore(mScene, turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().ChipsOffset), 0, turret_id);

            if (turret_id == 0 || turret_id == 1)
            {
                EbVector3 offset = mScene.getRenderConfigure().TurretPanelScoreOffset;
                offset.x += mScene.getRenderConfigure().UpTurretPanelScoreOffset;
                //mCSpriteScore.setDigitPosition(turret_helper.getPositionByOffset(turret_id, offset), 0);
            }
            else
            {
                //mCSpriteScore.setDigitPosition(turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().TurretPanelScoreOffset), base_angle);
            }
            //mCSpriteScore.setBgPosition(turret_helper.getPositionByOffset(turret_id, mScene.getRenderConfigure().TurretPanelScoreBgOffset), base_angle);
        }
Пример #10
0
        //-------------------------------------------------------------------------
        void _s2allcEfxFire(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int       index              = 0;
            uint      et_player_rpcid    = uint.Parse(vec_param[++index]);
            int       bullet_vibid       = int.Parse(vec_param[++index]);
            int       bullet_objid       = int.Parse(vec_param[++index]);
            float     level_total_second = float.Parse(vec_param[++index]);
            float     turret_angle       = float.Parse(vec_param[++index]);
            int       turret_rate        = int.Parse(vec_param[++index]);
            float     posX = float.Parse(vec_param[++index]);
            float     posY = float.Parse(vec_param[++index]);
            float     posZ = float.Parse(vec_param[++index]);
            EbVector3 pos  = new EbVector3(posX, posY, posZ);

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcEfxFire(bullet_vibid, bullet_objid, level_total_second, turret_angle, turret_rate, pos);
            }
        }
Пример #11
0
 //-------------------------------------------------------------------------
 public void destroyAllTurret()
 {
     foreach (var i in mMapPlayerTurret)
     {
         i.Value.Dispose();
     }
     mMapPlayerTurret.Clear();
     mMyTurret = null;
 }
Пример #12
0
        //-------------------------------------------------------------------------
        public CRenderBuffer(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string animation_name)
        {
            mScene         = scene;
            mTurret        = turret;
            mName          = name;
            mParam         = param;
            mAnimationName = animation_name;

            _initCSprite(mName, "CSpriteBuffer" + mTurret.getTurretId().ToString());
        }
Пример #13
0
        //-------------------------------------------------------------------------
        public CRenderBufferRapid(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
            : base(scene, turret, name, param, prefab_name)
        {
            if (_isMe())
            {
                mScene.getProtocol().c2sBeginRapid(mScene.getMyPlayerId());
            }

            //mScene.getListener().onSceneShowInfo("开始极速发炮");
        }
Пример #14
0
        //-------------------------------------------------------------------------
        public CRenderBuffer(CRenderScene scene, CRenderTurret turret, string name, List<object> param, string animation_name)
        {
            mScene = scene;
            mTurret = turret;
            mName = name;
            mParam = param;
            mAnimationName = animation_name;

            _initCSprite(mName, "CSpriteBuffer" + mTurret.getTurretId().ToString());
        }
Пример #15
0
        //-------------------------------------------------------------------------
        public CRenderBufferRapid(CRenderScene scene, CRenderTurret turret, string name, List<object> param, string prefab_name)
            : base(scene, turret, name, param, prefab_name)
        {
            if (_isMe())
            {
                mScene.getProtocol().c2sBeginRapid(mScene.getMyPlayerId());
            }

            //mScene.getListener().onSceneShowInfo("开始极速发炮");
        }
Пример #16
0
        //-------------------------------------------------------------------------
        public void setTurret(uint et_player_rpcid, TbDataTurret.TurretType turret_type)
        {
            CRenderTurret turret = getTurret(et_player_rpcid);

            if (turret == null)
            {
                return;
            }
            turret.setTurret(turret_type);
        }
Пример #17
0
        //-------------------------------------------------------------------------
        public CRenderTurret createTurret(int turret_id, ref _tScenePlayer scene_player, int player_gold,
                                          bool buffer_power, bool buffer_freeze, bool buffer_longpress, bool buffer_rapid,
                                          int turret_rate, float turret_angle, int locked_fish_objid, TbDataTurret.TurretType turret_type)
        {
            CRenderTurret turret = new CRenderTurret(this);

            turret.create(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
                          buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);
            mMapPlayerTurret[scene_player.et_player_rpcid] = turret;
            return(turret);
        }
Пример #18
0
        void ss()
        {
            CRenderTurret turret = mScene.getTurret(mPlayerId);

            if (turret == null)
            {
                return;
            }
            TbDataFish fish_data = EbDataMgr.Instance.getData <TbDataFish>(mFishVibId);

            turret.displayScoreTurnplate(mTotalScore, fish_data.TurnplateParticle);
        }
Пример #19
0
        //-------------------------------------------------------------------------
        void _s2allcPlayerEnter(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int           index = 0;
            _tScenePlayer scene_player;

            scene_player.et_player_rpcid = uint.Parse(vec_param[++index]);
            scene_player.nickname        = (string)vec_param[++index];
            scene_player.is_bot          = false;
            int player_gold = int.Parse(vec_param[++index]);

            scene_player.rate = float.Parse(vec_param[++index]);
            int   turret_id        = int.Parse(vec_param[++index]);
            bool  buffer_power     = bool.Parse(vec_param[++index]);
            bool  buffer_freeze    = bool.Parse(vec_param[++index]);
            bool  buffer_longpress = bool.Parse(vec_param[++index]);
            bool  buffer_rapid     = bool.Parse(vec_param[++index]);
            float turret_angle     = float.Parse(vec_param[++index]);
            int   turret_rate      = int.Parse(vec_param[++index]);

            TbDataTurret.TurretType turret_type = (TbDataTurret.TurretType)(short.Parse(vec_param[++index]));
            int locked_fish_objid = int.Parse(vec_param[++index]);

            Dictionary <uint, CRenderTurret> map_turret = mScene.getMapTurret();

            if (map_turret.ContainsKey(scene_player.et_player_rpcid))
            {
                map_turret[scene_player.et_player_rpcid].Dispose();
                map_turret.Remove(scene_player.et_player_rpcid);
            }

            if (mScene.getMyPlayerId() == scene_player.et_player_rpcid)
            {
                mScene.setMyTurret(null);
            }

            CRenderTurret turret = new CRenderTurret(mScene);

            turret.create(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
                          buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);
            map_turret[scene_player.et_player_rpcid] = turret;

            if (mScene.getMyPlayerId() == scene_player.et_player_rpcid)
            {
                mScene.setMyTurret(turret);
            }
        }
Пример #20
0
        //-------------------------------------------------------------------------
        // 服务端广播消息:鱼死亡
        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");
            }
        }
Пример #21
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene = scene;

            if (mScene.isBot()) return;

            mCSpriteTurretScoreShow = new CSpriteTurretScoreShow();
            mCSpriteTurretScoreShow.create(scene, render_turret);

            mSpriteTurret = new CSpriteTurret();
            mSpriteTurret.create(scene, render_turret);
            mSpriteTurret.aimAt(render_turret.getTurretAngle());
            mSpriteTurret.displayRate(render_turret.getTurretRate());
            mSpriteTurret.reloadAnimation();
        }
Пример #22
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene        = scene;
            mRenderTurret = render_turret;

            mCSpriteTurretFort = new CSpriteTurretFort();
            mCSpriteTurretFort.create(mScene, mRenderTurret);

            mLinkLockedFishFeature = new LinkLockedFishFeature(mScene, mRenderTurret);

            //mRateNumber = new CSpriteNumber(mScene, new CPanelDigitFactory(mScene));
            //mRateNumber.create(0, mRateNumberPosition, mRateNumberAngel, CSpriteNumber._eNumberSize.Small1);
            //mRateNumber.setTag("CSpriteTurret" + mRenderTurret.getTurretId());
            //mRateNumber.setTrigger(true);
        }
Пример #23
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene = scene;
            mRenderTurret = render_turret;

            mCSpriteTurretFort = new CSpriteTurretFort();
            mCSpriteTurretFort.create(mScene, mRenderTurret);

            mLinkLockedFishFeature = new LinkLockedFishFeature(mScene, mRenderTurret);

            //mRateNumber = new CSpriteNumber(mScene, new CPanelDigitFactory(mScene));
            //mRateNumber.create(0, mRateNumberPosition, mRateNumberAngel, CSpriteNumber._eNumberSize.Small1);
            //mRateNumber.setTag("CSpriteTurret" + mRenderTurret.getTurretId());
            //mRateNumber.setTrigger(true);
        }
Пример #24
0
        //-------------------------------------------------------------------------
        void _s2allcEndPower(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int  index           = 0;
            uint et_player_rpcid = uint.Parse(vec_param[++index]);

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcEndPower();
            }
        }
Пример #25
0
        //-------------------------------------------------------------------------
        void _particleFixedTarget(StillParticle still_particle, TbDataFish.ParticleDataStruct particle_data, uint et_player_rpcid)
        {
            CRenderTurret turret         = mScene.getTurret(et_player_rpcid);
            EbVector3     start_position = EbVector3.Zero;

            if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fish)
            {
                start_position = mCRenderFish.Position;
            }
            else if (particle_data.StartPoint.ParticlePointType == TbDataFish.ParticlePointStruct.ParticlePointTypeEnum.Fixed)
            {
                start_position = new EbVector3(particle_data.StartPoint.x, particle_data.StartPoint.y, 0);
            }

            still_particle.setRoute(RouteHelper.buildLineRoute(
                                        start_position, new EbVector3(particle_data.TargetPoint.x, particle_data.TargetPoint.y, 0)), 200);
        }
Пример #26
0
        //-------------------------------------------------------------------------
        public void create(CRenderScene scene, CRenderTurret render_turret)
        {
            mScene = scene;

            if (mScene.isBot())
            {
                return;
            }

            mCSpriteTurretScoreShow = new CSpriteTurretScoreShow();
            mCSpriteTurretScoreShow.create(scene, render_turret);

            mSpriteTurret = new CSpriteTurret();
            mSpriteTurret.create(scene, render_turret);
            mSpriteTurret.aimAt(render_turret.getTurretAngle());
            mSpriteTurret.displayRate(render_turret.getTurretRate());
            mSpriteTurret.reloadAnimation();
        }
Пример #27
0
        //-------------------------------------------------------------------------
        void _s2allcLockFish(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int  index           = 0;
            uint et_player_rpcid = uint.Parse(vec_param[++index]);
            int  locked_fish_id  = int.Parse(vec_param[++index]);

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcLockFish(locked_fish_id);
            }
        }
Пример #28
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));
            }
        }
Пример #29
0
        //-------------------------------------------------------------------------
        void _s2allcManualFire(List <string> vec_param)
        {
            if (!mScene.isInit())
            {
                return;
            }

            int   index           = 0;
            uint  et_player_rpcid = uint.Parse(vec_param[++index]);
            int   bullet_objid    = int.Parse(vec_param[++index]);
            float turret_angle    = float.Parse(vec_param[++index]);
            int   turret_rate     = int.Parse(vec_param[++index]);
            int   locked_fish_id  = int.Parse(vec_param[++index]);

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret != null)
            {
                turret.s2allcManualFire(bullet_objid, turret_angle, turret_rate, locked_fish_id);
            }
        }
Пример #30
0
        //-------------------------------------------------------------------------
        public void fishCoins(uint et_player_rpcid)
        {
            if (null == mFishData.mCoinParticle.CointParticleData)
            {
                return;
            }
            if (mFishData.mCoinParticle.CointParticleData.Id <= 0)
            {
                return;
            }

            CRenderTurret turret = mScene.getTurret(et_player_rpcid);

            if (turret == null)
            {
                return;
            }

            string coin_particle_name = mFishData.mCoinParticle.CointParticleData.ParticlePrefabName;
            int    radius             = mFishData.mCoinParticle.Radius;
            int    coin_count         = mFishData.mCoinParticle.CointCount;

            if (radius <= 0)
            {
                radius = 30;
            }
            if (coin_count <= 0)
            {
                coin_count = 1;
            }

            float layer = mScene.getLayerAlloter().getLayer(_eLevelLayer.Coin);

            StillParticle still_particle = mParticlemanager.newParticle(coin_particle_name);

            still_particle.setLayer(layer);
            still_particle.create(mCRenderFish.Position.logic2pixel(), turret.getTurretPos().logic2pixel(), coin_count, layer);
        }
Пример #31
0
 //-------------------------------------------------------------------------
 public void setMyTurret(CRenderTurret my_turret)
 {
     mMyTurret = my_turret;
 }
Пример #32
0
 //-------------------------------------------------------------------------
 public void destroyAllTurret()
 {
     foreach (var i in mMapPlayerTurret)
     {
         i.Value.Dispose();
     }
     mMapPlayerTurret.Clear();
     mMyTurret = null;
 }
Пример #33
0
 //-------------------------------------------------------------------------
 public CRenderTurret createTurret(int turret_id, ref _tScenePlayer scene_player, int player_gold,
     bool buffer_power, bool buffer_freeze, bool buffer_longpress, bool buffer_rapid,
     int turret_rate, float turret_angle, int locked_fish_objid, TbDataTurret.TurretType turret_type)
 {
     CRenderTurret turret = new CRenderTurret(this);
     turret.create(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
             buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);
     mMapPlayerTurret[scene_player.et_player_rpcid] = turret;
     return turret;
 }
Пример #34
0
        //-------------------------------------------------------------------------
        void _s2allcPlayerEnter(List<string> vec_param)
        {
            if (!mScene.isInit()) return;

            int index = 0;
            _tScenePlayer scene_player;
            scene_player.et_player_rpcid = uint.Parse(vec_param[++index]);
            scene_player.nickname = (string)vec_param[++index];
            scene_player.is_bot = false;
            int player_gold = int.Parse(vec_param[++index]);
            scene_player.rate = float.Parse(vec_param[++index]);
            int turret_id = int.Parse(vec_param[++index]);
            bool buffer_power = bool.Parse(vec_param[++index]);
            bool buffer_freeze = bool.Parse(vec_param[++index]);
            bool buffer_longpress = bool.Parse(vec_param[++index]);
            bool buffer_rapid = bool.Parse(vec_param[++index]);
            float turret_angle = float.Parse(vec_param[++index]);
            int turret_rate = int.Parse(vec_param[++index]);
            TbDataTurret.TurretType turret_type = (TbDataTurret.TurretType)(short.Parse(vec_param[++index]));
            int locked_fish_objid = int.Parse(vec_param[++index]);

            Dictionary<uint, CRenderTurret> map_turret = mScene.getMapTurret();
            if (map_turret.ContainsKey(scene_player.et_player_rpcid))
            {
                map_turret[scene_player.et_player_rpcid].Dispose();
                map_turret.Remove(scene_player.et_player_rpcid);
            }

            if (mScene.getMyPlayerId() == scene_player.et_player_rpcid)
            {
                mScene.setMyTurret(null);
            }

            CRenderTurret turret = new CRenderTurret(mScene);
            turret.create(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
                buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);
            map_turret[scene_player.et_player_rpcid] = turret;

            if (mScene.getMyPlayerId() == scene_player.et_player_rpcid)
            {
                mScene.setMyTurret(turret);
            }
        }
Пример #35
0
 //-------------------------------------------------------------------------
 public CRenderBufferLock(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string animation_name)
     : base(scene, turret, name, param, animation_name)
 {
     mScene = scene;
     resetLockedFishObjId((int)param[0]);
 }
Пример #36
0
 //-------------------------------------------------------------------------
 public CRenderBufferLock(CRenderScene scene, CRenderTurret turret, string name, List<object> param, string animation_name)
     : base(scene, turret, name, param, animation_name)
 {
     mScene = scene;
     resetLockedFishObjId((int)param[0]);
 }
Пример #37
0
        //-------------------------------------------------------------------------
        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);
        }
Пример #38
0
 //-------------------------------------------------------------------------
 public CRenderBufferPower(CRenderScene scene, CRenderTurret turret, string name, List<object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     mTurret.setBarrelColor(new Color(1, 0, 0));
 }
Пример #39
0
 //-------------------------------------------------------------------------
 public CRenderBufferPower(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     mTurret.setBarrelColor(new Color(1, 0, 0));
 }
Пример #40
0
        //-------------------------------------------------------------------------
        void _s2cSnapshotScene(List <string> vec_param)
        {
            EbLog.Note("CRenderProtocol._s2cSnapshotScene()");

            mScene.setInit();

            int  index           = 0;
            uint et_player_rpcid = uint.Parse(vec_param[++index]);

            if (et_player_rpcid != mScene.getMyPlayerId())
            {
                return;
            }

            _eLevelState level_state           = (_eLevelState)(short.Parse(vec_param[++index]));
            int          level_vibid           = int.Parse(vec_param[++index]);
            int          cur_map_vibid         = int.Parse(vec_param[++index]);
            int          next_map_vibid        = int.Parse(vec_param[++index]);
            float        level_run_totalsecond = float.Parse(vec_param[++index]);
            float        level_run_maxsecond   = float.Parse(vec_param[++index]);

            bool level_run_in_formation = bool.Parse(vec_param[++index]);

            mScene.destroyLevel();
            mScene.createLevel(level_state, level_vibid, cur_map_vibid, next_map_vibid, level_run_totalsecond, level_run_maxsecond, level_run_in_formation);

            mScene.destroyAllTurret();

            int        rate_list_count = int.Parse(vec_param[++index]);
            List <int> list_rate       = new List <int>(rate_list_count);

            for (int i = 0; i < rate_list_count; ++i)
            {
                list_rate.Add(int.Parse(vec_param[++index]));
            }

            mScene.setRateList(list_rate);

            int turret_count = int.Parse(vec_param[++index]);

            List <CRenderTurret> turret_list = new List <CRenderTurret>();

            for (int i = 0; i < turret_count; ++i)
            {
                _tScenePlayer scene_player;
                scene_player.et_player_rpcid = uint.Parse(vec_param[++index]);
                scene_player.nickname        = (string)vec_param[++index];
                int player_gold = int.Parse(vec_param[++index]);
                scene_player.is_bot = false;
                scene_player.rate   = float.Parse(vec_param[++index]);
                int   turret_id        = int.Parse(vec_param[++index]);
                bool  buffer_power     = bool.Parse(vec_param[++index]);
                bool  buffer_freeze    = bool.Parse(vec_param[++index]);
                bool  buffer_longpress = bool.Parse(vec_param[++index]);
                bool  buffer_rapid     = bool.Parse(vec_param[++index]);
                float turret_angle     = float.Parse(vec_param[++index]);
                int   turret_rate      = int.Parse(vec_param[++index]);
                TbDataTurret.TurretType turret_type = (TbDataTurret.TurretType)(byte.Parse(vec_param[++index]));
                int locked_fish_objid = int.Parse(vec_param[++index]);

                CRenderTurret turret = mScene.createTurret(turret_id, ref scene_player, player_gold, buffer_power, buffer_freeze, buffer_longpress,
                                                           buffer_rapid, turret_rate, turret_angle, locked_fish_objid, turret_type);

                turret_list.Add(turret);

                if (mScene.getMyPlayerId() == scene_player.et_player_rpcid)
                {
                    mScene.setMyTurret(turret);
                }
            }

            // 通知场景初始化完成
            mScene.getListener().onSceneSnapshot();

            foreach (var turret in turret_list)
            {
                turret.displayScore();
            }
        }
Пример #41
0
 //-------------------------------------------------------------------------
 public CRenderBufferFreeze(CRenderScene scene, CRenderTurret turret, string name, List<object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     //mScene.getListener().onSceneShowInfo("创建冻结buffer");
 }
Пример #42
0
 //-------------------------------------------------------------------------
 public CRenderBufferFreeze(CRenderScene scene, CRenderTurret turret, string name, List <object> param, string prefab_name)
     : base(scene, turret, name, param, prefab_name)
 {
     //mScene.getListener().onSceneShowInfo("创建冻结buffer");
 }
Пример #43
0
        //-------------------------------------------------------------------------
        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();
        }
Пример #44
0
 //-------------------------------------------------------------------------
 public void setMyTurret(CRenderTurret my_turret)
 {
     mMyTurret = my_turret;
 }