Esempio n. 1
0
        //清场动画
        public void ClearScene(NetCmdPack pack)
        {
            byte clearType   = ((NetCmdClearScene)pack.cmd).ClearType;
            bool leftToRight = clearType == 0;
            bool bNotDelay   = Utility.GetTickCount() - pack.tick < ConstValue.FISH_OVER_TIME;

            if (bNotDelay == false || clearType == 2)
            {
                SceneRuntime.FishMgr.ClearAllFish();
                return;
            }
            SceneRuntime.SceneModel.SetClearScene();
            //GlobalAudioMgr.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.m_ClearFish);
            ushort           id     = leftToRight ? (ushort)8 : (ushort)7;
            GameObject       effect = SceneRuntime.EffectMgr.GetSkillEffect(id);
            GlobalEffectData gfd    = new GlobalEffectData(effect, 0, 4.0f);

            GlobalEffectMgr.Instance.AddEffect(gfd);
            if (leftToRight)
            {
                PathManager.Instance.BoLang.SetWorldMatrix(Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(0, Vector3.up), Vector3.one));
            }
            else
            {
                PathManager.Instance.BoLang.SetWorldMatrix(Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(180, Vector3.up), Vector3.one));
            }
            SceneRuntime.FishMgr.BackupFishList();

            if (SceneRuntime.FishMgr.BackFishList != null)
            {
                foreach (Fish fish in SceneRuntime.FishMgr.BackFishList)
                {
                    if (fish.Delay || fish.Catched)
                    {
                        continue;
                    }

                    GameObject effectobj = SceneRuntime.EffectMgr.GetSkillEffect(9);
                    float      z         = SceneRuntime.ComputeZScaling(fish, 1.0f);
                    float      scl       = z * fish.Scaling * 1.0f;
                    effectobj.transform.localScale = new Vector3(scl, scl, scl);
                    GlobalEffectData gfdf = new GlobalEffectData(fish, effectobj, 0, 4.0f, null, scl);
                    float            y    = FishResManager.Instance.GetFishData(fish.FishType).Size.y;
                    gfdf.Offset = new Vector3(0, y * 0.65f * z * fish.Scaling, 0);
                    GlobalEffectMgr.Instance.AddEffect(gfdf);
                    fish.ExtraData = gfdf;
                    FishOptTimer fot = new FishOptTimer(gfd, PathManager.Instance.BoLang, leftToRight);
                    fish.ClearOpt();
                    fish.AddOpt(fot);
                }
            }
        }
Esempio n. 2
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);
        }