Exemple #1
0
        public override bool Update(float delta, Fish fish, out bool bRemove)
        {
            float x = Camera.main.WorldToScreenPoint(fish.Position).x;

            if (m_LeftToRight)
            {
                x /= Screen.width;
            }
            else
            {
                x = (Screen.width - x) / Screen.width;
            }

            float delay = x * 1.5f + 1.1f;

            if (delay <= m_Timer.LifeTime || m_Timer.IsEnd)
            {
                fish.StopLaugh(false);
                if (fish.ExtraData != null)
                {
                    GlobalEffectData gfd = (GlobalEffectData)fish.ExtraData;
                    fish.ExtraData = null;
                    gfd.Life       = 0;
                }
                float transRot = -Utility.Range(100, 200);
                float pathRot  = -Utility.Range(300, 500);
                float speed    = Utility.Range(15, 20) * SceneRuntime.ComputeZScaling(fish, 1.0f);

                FishOptPath fop = new FishOptPath(PathManager.Instance.BoLang, transRot, pathRot, speed, 0, fish.Position, true);
                fop.SetDeadData(0, false, null);
                fish.AddOpt(fop);
                bRemove = true;
            }
            else
            {
                bRemove = false;
            }
            return(true);
        }
Exemple #2
0
        public void UseSkillDisaster(NetCmdPack pack)
        {
            NetCmdSkillDisaster cmd = (NetCmdSkillDisaster)pack.cmd;
            bool bNotDelay          = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;
            byte clientSeat         = SceneRuntime.ServerToClientSeat(cmd.Seat);

            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
            {
                return;
            }

            CatchedData cd = new CatchedData();

            cd.CatchType  = (byte)CatchedType.CATCHED_SKILL;
            cd.SubType    = (byte)SkillType.SKILL_DISASTER;
            cd.FishList   = new List <CatchFishData>();
            cd.ClientSeat = clientSeat;
            cd.RateIndex  = SceneRuntime.PlayerMgr.GetPlayer(cd.ClientSeat).RateIndex;

            RecordSkill(SkillType.SKILL_DISASTER, clientSeat);
            if (bNotDelay == false)
            {
                ProcessDelayOver(cmd.FishID, cd);
                return;
            }
            CatchLithingList cll = null;

            SceneRuntime.PlayerMgr.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_DISASTER].CDTime);
            //SceneRuntime.SceneModel.LogicUI.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_DISASTER].CDTime, SkillType.SKILL_DISASTER);
            GameObject       effect = SceneRuntime.EffectMgr.GetSkillEffect(6);
            GlobalEffectData gfd    = new GlobalEffectData(effect, 0, 5.0f);

            GlobalEffectMgr.Instance.AddEffect(gfd);
            //SceneObjMgr.Instance.PlayBack(BackAnimType.BACK_ANIM_TZ);
            SceneRuntime.PlayerMgr.PlaySkillAvatarEft(clientSeat);

            BlendData bd = new BlendData();

            bd.BaseTex    = SceneRuntime.EffectMgr.SkillDisasterTex;
            bd.EffectTex  = bd.BaseTex;
            bd.Blend_Type = (byte)BlendType.BLEND_ADD_TEX;
            bd.Duration1  = 1.0f;
            bd.Duration2  = 2.0f;
            bd.Factor     = 3.0f;

            FishOptPath pt = new FishOptPath(PathManager.Instance.DouDongPath, 0, 0, 1, 0, Vector3.zero);

            if (cmd.FishID != null)
            {
                for (int i = 0; i < cmd.FishID.Length; ++i)
                {
                    NetFishDeadTime dt  = cmd.FishID[i];
                    CatchFishData   cfd = SceneRuntime.FishMgr.FindFish(dt.FishID);
                    if (cfd.FishObj != null)
                    {
                        Fish fish = cfd.FishObj;
                        fish.StopLaugh(false);
                        float         t  = dt.DeadTime * ConstValue.INV255;
                        ReductionData rd = new ReductionData();

                        float dt1 = Utility.LerpFloat(FishSetting.FishDeadTime.TianZai_Dead_Time1, FishSetting.FishDeadTime.TianZai_Dead_Time1, t);
                        float dt2 = Utility.LerpFloat(FishSetting.FishDeadTime.TianZai_Stay_Time1, FishSetting.FishDeadTime.TianZai_Stay_Time2, t);
                        rd.Duration1 = dt1 + FishSetting.FishDeadTime.TianZai_DouDong_Time;

                        if (dt.LightingFishID != 0)
                        {
                            if (cll == null)
                            {
                                cll = new CatchLithingList();
                            }

                            CatchFishData cfd2 = SceneRuntime.FishMgr.FindFish(dt.LightingFishID);
                            if (cfd2.FishObj != null)
                            {
                                cll.AddSubFish(cfd2.FishObj, fish);
                            }
                        }

                        rd.Duration2 = dt2;
                        rd.Speed     = FishSetting.FishDeadTime.TianZai_Speed;
                        fish.ClearOpt();
                        FishOptOffset foo = new FishOptOffset(FishSetting.FishDeadTime.TianZai_DouDong_Time, PathManager.Instance.DouDongPath);
                        foo.Delay = dt1;
                        fish.AddOpt(foo);

                        FishOptReduction fr = new FishOptReduction(0, rd, rd.Duration1, bd);
                        fr.DeadType  = FishDeadType.DEAD_ACTION;
                        fr.CatchData = cd;
                        fish.SetCatched(clientSeat);
                        fish.AddOpt(fr);
                        fish.SetDropReward(dt.nReward);

                        cd.FishList.Add(cfd);
                    }
                    else if (cfd.IsValidFishType())
                    {
                        // SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        byte multiple = (byte)SkillSetting.SkillDataList[(byte)SkillType.SKILL_DISASTER].multiple;
                        SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, multiple));
                        cd.FishList.Add(cfd);
                    }
                }
            }
            SceneRuntime.ComputeGoldNum(cd);
            SceneRuntime.SceneModel.CatchFish(cd);
            if (cll != null)
            {
                cll.DelayTime = 1.0f;
                m_LightinData.Add(cll);
                //ProcessLightingData(cll);
            }
            //SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, cd.GoldNum);
            //if (clientSeat == SceneRuntime.MyClientSeat)
            //{
            //    if (cd.GoldNum != cmd.GoldNum)
            //    {
            //        LogMgr.Log("天灾:金币不相等:" + cd.GoldNum + "," + cmd.GoldNum);
            //    }
            //    else if (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() != cmd.TotalNum)
            //    {
            //        LogMgr.Log("天灾:总金币不相等:" + (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel()) + "," + cmd.TotalNum);
            //    }
            //}
        }
Exemple #3
0
        public void UseSkillTornado(NetCmdPack pack)
        {
            NetCmdSkillTornado cmd = (NetCmdSkillTornado)pack.cmd;
            bool bNotDelay         = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;
            byte clientSeat        = SceneRuntime.ServerToClientSeat(cmd.Seat);

            if (SceneRuntime.PlayerMgr.GetPlayer(clientSeat) == null)
            {
                return;
            }
            CatchedData cd = new CatchedData();

            cd.CatchType  = (byte)CatchedType.CATCHED_SKILL;
            cd.SubType    = (byte)SkillType.SKILL_TORNADO;
            cd.FishList   = new List <CatchFishData>();
            cd.ClientSeat = clientSeat;
            cd.RateIndex  = SceneRuntime.PlayerMgr.GetPlayer(cd.ClientSeat).RateIndex;

            RecordSkill(SkillType.SKILL_TORNADO, clientSeat);
            if (bNotDelay == false)
            {
                ProcessDelayOver(cmd.fishID, cd);
                return;
            }

            Vector3[] pos = new Vector3[3];
            SceneRuntime.PlayerMgr.PlayCD(SkillSetting.SkillDataList[(byte)SkillType.SKILL_TORNADO].CDTime);

            /*SceneRuntime.SceneModel.LogicUI.PlayCD(SkillSetting.SkillDataList[(byte) SkillType.SKILL_TORNADO].CDTime,
             *  SkillType.SKILL_TORNADO);*/
            GetTornadoPos(pos);
            GameObject effect = SceneRuntime.EffectMgr.GetSkillEffect(1);

            effect.transform.localPosition = new Vector3(0, 0, 500);
            GlobalEffectData gfd = new GlobalEffectData(effect, 0, 5.0f);

            GlobalEffectMgr.Instance.AddEffect(gfd);
            //SceneObjMgr.Instance.PlayBack(BackAnimType.BACK_ANIM_JF);

            for (int i = 0; i < 3; ++i)
            {
                effect = SceneRuntime.EffectMgr.GetSkillEffect(0);
                Vector3 p = pos[i];
                p.y -= 50;
                effect.transform.localPosition = pos[i];
                gfd = new GlobalEffectData(effect, 0, 5.0f);
                GlobalEffectMgr.Instance.AddEffect(gfd);
            }
            SceneRuntime.PlayerMgr.PlaySkillAvatarEft(clientSeat);
            if (cmd.fishID != null)
            {
                for (int i = 0; i < cmd.fishID.Length; ++i)
                {
                    CatchFishData cfd = SceneRuntime.FishMgr.FindFish(cmd.fishID[i].FishID);
                    if (cfd.FishObj != null)
                    {
                        Fish fish = cfd.FishObj;
                        fish.StopLaugh(false);
                        float d1     = new Vector2(fish.Position.x - pos[0].x, fish.Position.y - pos[0].y).sqrMagnitude;
                        float d2     = new Vector2(fish.Position.x - pos[1].x, fish.Position.y - pos[1].y).sqrMagnitude;
                        float d3     = new Vector2(fish.Position.x - pos[2].x, fish.Position.y - pos[2].y).sqrMagnitude;
                        int   posidx = (d1 < d2) ? (d1 < d3 ? 0 : 2) : (d2 < d3 ? 1 : 2);

                        float transRot  = -Utility.Range(1000, 2000);
                        float pathRot   = -Utility.Range(3000, 5000);
                        float speed     = Utility.Range(4, 8);
                        float transTime = Utility.Range(0.3f, 0.6f);
                        int   idx       = Utility.Range(0, PathManager.Instance.LongJuanFeng.Length);

                        float delay = Utility.LerpFloat(FishSetting.FishDeadTime.LongJuanFeng_Dead_Time1,
                                                        FishSetting.FishDeadTime.LongJuanFeng_Dead_Time2, Utility.Range(0.0f, 1.0f));
                        ReductionData rd = new ReductionData();
                        rd.Speed     = 0;
                        rd.Duration1 = delay;
                        FishOptReduction f   = new FishOptReduction(0.0f, rd);
                        FishOptPath      fop = new FishOptPath(PathManager.Instance.LongJuanFeng[idx], transRot, pathRot,
                                                               speed, transTime, pos[posidx] + new Vector3(0, 50, 0));
                        fop.SetDeadData(delay, false, cd);
                        fish.ClearOpt();
                        fish.AddOpt(fop);
                        fish.SetCatched(clientSeat);
                        cd.FishList.Add(cfd);

                        fish.SetDropReward(cmd.fishID[i].nReward);
                    }
                    else if (cfd.IsValidFishType())
                    {
                        // SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, SceneRuntime.GetFishGold(cfd.FishType, cd.RateIndex));
                        byte multiple = (byte)SkillSetting.SkillDataList[(byte)SkillType.SKILL_TORNADO].multiple;
                        SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat,
                                                                SceneRuntime.GetFishGold(cfd.FishType, multiple));

                        cd.FishList.Add(cfd);
                    }
                }
            }
            SceneRuntime.ComputeGoldNum(cd);
            //SceneRuntime.SceneModel.CatchFish(cd);
            //SceneRuntime.PlayerMgr.UpdatePlayerGold(clientSeat, cd.GoldNum);
            //if (clientSeat == SceneRuntime.MyClientSeat)
            //{
            //    if (cd.GoldNum != cmd.GoldNum)
            //    {
            //        LogMgr.Log("龙卷风:金币不相等:" + cd.GoldNum + "," + cmd.GoldNum);
            //    }
            //    else if (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() != cmd.TotalNum)
            //    {
            //        LogMgr.Log("龙卷风:总金币不相等:" + (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel()) + "," + cmd.TotalNum);
            //    }
            //}
        }