Esempio n. 1
0
        //---------------------------------------------------------------------
        void generateFormation(string particle_system_name)
        {
            int fish_begin_obj_id = getNextFishObjId(mBaseFishLordMgr.getCountOfParticleSystemEntity(particle_system_name));

            mBaseFishLordMgr.addParticleSystem(particle_system_name, new List <string>(), fish_begin_obj_id);
            mScene.getProtocol().s2allcCreateFishLord(particle_system_name, new List <string>(), fish_begin_obj_id);
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        // 计算鱼死亡分值并更新玩家状态
        void _calculateFishScore(uint et_player_rpcid, CLogicTurret turret, CLogicFish fish, int rate, int bullet_objid)
        {
            // 计算鱼的死亡概率,鱼死亡则销毁
            int score = 1;// 分值
            int effect_fish_vib_id = -1;

            bool fish_die = fish.hit(et_player_rpcid, rate, ref score, ref effect_fish_vib_id);

            if (fish_die)
            {
                // 奖励金币
                if (turret.getBufferPower())
                {
                    rate *= 2;
                }
                int total_score = rate * score;

                _tScenePlayer player   = turret.getScenePlayerInfo();
                int           cur_gold = mScene.getListener().onLogicSceneGetPlayerGold(player.et_player_rpcid);
                cur_gold += total_score;
                mScene.getListener().onLogicSceneSetPlayerGold(player.et_player_rpcid, cur_gold, fish.FishVibId, "FishLord", rate);

                // 通知其他模块鱼死亡
                mScene.getListener().onLogicSceneFishDie(et_player_rpcid, fish.FishVibId, total_score);

                // 服务端广播鱼死亡
                mScene.getProtocol().s2allcFishDie(et_player_rpcid,
                                                   total_score, bullet_objid, fish.FishObjId, effect_fish_vib_id, rate);
            }
        }
        //---------------------------------------------------------------------
        public override void enter()
        {
            mfCurSecond = 0.0f;

            // 切换地图
            if (mLevel.CurMapVibId == 0)
            {
                mLevel.CurMapVibId = mLevel.genRandomMap();
            }
            else if (mLevel.NextMapVibId != 0)
            {
                mLevel.CurMapVibId  = mLevel.NextMapVibId;
                mLevel.NextMapVibId = 0;
            }

            // 服务端广播关卡更新
            mScene.getProtocol().s2allcLevelUpdate(_eLevelState.Normal, mLevel.getLevelVibId(),
                                                   mLevel.CurMapVibId, mLevel.NextMapVibId, mfCurSecond, mfMaxSecond);

            if (mIsFistLevel)
            {
                mIsFistLevel = false;
            }
            else
            {
                mLevel.outFormation();
            }
        }
Esempio n. 4
0
        //-------------------------------------------------------------------------
        public override void create(Dictionary <string, object> param)
        {
            mMapParam = param;
            mScene    = mMapParam["LogicScene"] as CLogicScene;
            mPos      = (EbVector3)mMapParam["SourcePosition"];

            uint            et_player_rpcid = (uint)mMapParam["PlayerID"];
            int             bullet_rate     = (int)mMapParam["BulletRate"];
            TbDataEffectAOE effect_data     = EbDataMgr.Instance.getData <TbDataEffectAOE>(mEffectId);

            int  total_score        = 0;
            int  fish_score         = 0;
            int  effect_fish_vib_id = -1;
            bool fish_die           = false;

            List <CLogicFish> fish_list         = getFishByPositionAndRadius(mPos, (float)effect_data.Radius);
            List <string>     custom_param_list = new List <string>();

            // 遍历aoe范围内的活鱼
            foreach (var fish in fish_list)
            {
                // 检查是否在鱼的销毁列表,如果在则跳过,防止重复计算。
                if (fish.IsDie)
                {
                    continue;
                }
                // 击中鱼测试,击中则把分数包括特效分数计下来,一起计算到aoe特效分数里面去。
                fish_score         = 0;
                effect_fish_vib_id = -1;
                fish_die           = fish.hit(et_player_rpcid, bullet_rate, ref fish_score, ref effect_fish_vib_id);

                if (fish_die)
                {
                    custom_param_list.Add(fish.FishObjId.ToString());
                    total_score += fish_score;
                }
            }

            // 服务端广播创建特效
            int current_die_fish_id = (int)mMapParam["DieFishObjId"];//触发这个效果的鱼

            mScene.getProtocol().s2allcCreateClientEffect(
                et_player_rpcid, bullet_rate, mPos, current_die_fish_id,
                mEffectId, mEffectName, (int)mEffectType, mDelayTime,
                custom_param_list);

            mReturnValue = new List <object>();
            ReturnValue.Add("EffectAOE");
            ReturnValue.Add(total_score);
        }
Esempio n. 5
0
        //-------------------------------------------------------------------------
        public override void start()
        {
            base.start();

            mScene = (CLogicScene)mMapParam["LogicScene"];
            TbDataEffectLockScreen effect_data = EbDataMgr.Instance.getData <TbDataEffectLockScreen>(mEffectId);

            mScene.getLevel().setTimeFactor(0.0f);
            mFunDelayTime = effect_data.LastTime;

            uint      et_player_rpcid     = (uint)mMapParam["PlayerID"];
            int       bullet_rate         = (int)mMapParam["BulletRate"];
            EbVector3 source_position     = (EbVector3)mMapParam["SourcePosition"];
            int       current_die_fish_id = (int)mMapParam["DieFishObjId"];//触发这个效果的鱼

            mScene.getProtocol().s2allcCreateClientEffect(
                et_player_rpcid, bullet_rate, source_position, current_die_fish_id,
                mEffectId, mEffectName, (int)mEffectType, mDelayTime,
                new List <string>());
        }
        //---------------------------------------------------------------------
        public override void enter()
        {
            mfCurSecond = 0.0f;

            // 切换地图
            if (mLevel.NextMapVibId == 0)
            {
                mLevel.NextMapVibId = mLevel.genRandomMap();
            }
            while (mLevel.NextMapVibId == mLevel.CurMapVibId)
            {
                mLevel.NextMapVibId = mLevel.genRandomMap();
            }

            // 清除所有鱼
            mLevel.clearAllFish();

            // 服务端广播关卡更新
            mScene.getProtocol().s2allcLevelUpdate(_eLevelState.Switch, mLevel.getLevelVibId(),
                                                   mLevel.CurMapVibId, mLevel.NextMapVibId, mfCurSecond, mfMaxSecond);
        }
        //-------------------------------------------------------------------------
        public override void create(Dictionary <string, object> param)
        {
            mMapParam = param;
            mScene    = mMapParam["LogicScene"] as CLogicScene;
            mPos      = (EbVector3)mMapParam["SourcePosition"];

            uint et_player_rpcid = (uint)mMapParam["PlayerID"];
            int  bullet_rate     = (int)mMapParam["BulletRate"];
            int  die_fish_id     = (int)mMapParam["DieFishObjId"];

            int score = 0;

            TbDataEffectRadiationLighting effect_data = EbDataMgr.Instance.getData <TbDataEffectRadiationLighting>(mEffectId);
            List <CLogicFish>             fish_list   = mScene.getLevel().getListFishById(effect_data.NormalFish.Id);
            int each_fish_score = EbDataMgr.Instance.getData <TbDataFish>(effect_data.NormalFish.Id).FishScore;

            foreach (var n in fish_list)
            {
                score += each_fish_score;
                n.signDestroy();
            }

            // 服务端广播创建特效
            List <string> custom_param_list = new List <string>();

            custom_param_list.Add(effect_data.NormalFish.Id.ToString());

            mScene.getProtocol().s2allcCreateClientEffect(
                et_player_rpcid, bullet_rate, mPos, die_fish_id,
                mEffectId, mEffectName, (int)mEffectType, mDelayTime,
                custom_param_list);

            mReturnValue = new List <object>();
            ReturnValue.Add("Lighting");
            ReturnValue.Add(score);
            ReturnValue.Add(effect_data.NormalFish.Id);
        }
Esempio n. 8
0
        //---------------------------------------------------------------------
        public void update(float elapsed_tm)
        {
            mfTotalSecond += elapsed_tm;

            if (mLogicBot != null)
            {
                mLogicBot.update(elapsed_tm);
            }

            if (mBufferPower)
            {
                mCurTmBufferPower += elapsed_tm;
                if (mCurTmBufferPower >= mMaxTmBufferPower)
                {
                    mBufferPower      = false;
                    mCurTmBufferPower = 0.0f;
                    mScene.getProtocol().s2allcEndPower(mPlayer.et_player_rpcid);
                }
            }

            foreach (var i in mMapBullet)
            {
                i.Value.update(elapsed_tm);
            }

            while (mQueDestroyedBullet.Count > 0)
            {
                int i = mQueDestroyedBullet.Dequeue();
                if (mMapBullet.ContainsKey(i))
                {
                    CLogicBullet bullet = mMapBullet[i];
                    bullet.Dispose();
                    mMapBullet.Remove(i);
                }
            }
        }