Пример #1
0
        public void Init(ushort id, byte type, float scl, float time, float actionSpeed, bool actionUnite, float speed, PathLinearInterpolator interp)
        {
            ResFishData fd = FishResManager.Instance.GetFishData(type);

            if (fd == null)
            {
                Debug.Log("不存在的鱼模型:" + type.ToString());
                return;
            }
            m_CatchSeat = 0xff;
            m_bCatched  = false;
            m_Delay     = false;
            m_Scaling   = scl;
            m_FishID    = id;
            m_FishType  = type;

            m_PathCtrl = new PathController();
            m_PathCtrl.ResetController(interp, speed, time, fd.ClipLength[(byte)FishClipType.CLIP_CHAOFENG]);

            m_Model                   = (GameObject)GameObject.Instantiate(FishResManager.Instance.GetFishObj(type));
            m_ModelTransform          = m_Model.GetComponent <Transform>();
            m_ModelTransform.position = FishInitPos;
            m_Anim       = m_Model.GetComponent <Animator>();
            m_OrgRot     = m_ModelTransform.localRotation;
            m_Model.name = m_FishID.ToString();
            SetScaling(scl);
            m_Renderer = m_ModelTransform.GetChild(0).gameObject.GetComponent <Renderer>();
            if (m_Renderer == null)
            {
                m_Renderer = m_ModelTransform.GetChild(1).gameObject.GetComponent <Renderer>();
            }
            m_Anim.speed = actionSpeed;
            if (!actionUnite)
            {
                m_Anim.Play(YouYongHashName, 0, Utility.Range(0.0f, 1.0f));
            }
            if (IsBossFish())
            {
                m_bgsoundDelay = 2;
                AudioManager.Instance.StopBgMusic();
                //AudioManager.Instance.PlayOrdianryMusic(Audio.OrdianryMusic.m_bosscoming);

                //KonnoTool.ShowBossComingWindow();
            }
        }
Пример #2
0
        void NewInitProcedure(object od)
        {
            BinaryReader br             = (BinaryReader)od;
            ushort       pathCount      = br.ReadUInt16();
            ushort       pathGroupCount = br.ReadUInt16();
            ushort       fishGroupCount = br.ReadUInt16();
            ushort       fishDataCount  = br.ReadUInt16();

            for (ushort i = 0; i < pathCount; ++i)
            {
                PathLinearInterpolator pi    = ReadPathData(br);
                PathLinearInterpolator piInv = ReadPathData(br);
                m_PathInterpList.Add(pi);
                m_PathInterpListInv.Add(piInv);
            }

            for (ushort i = 0; i < pathGroupCount; ++i)
            {
                short subPathCount             = br.ReadInt16();
                PathLinearInterpolator[] pi    = ReadPathGroupData(br, subPathCount);
                PathLinearInterpolator[] piInv = ReadPathGroupData(br, subPathCount);
                m_PathGroupList.Add(pi);
                m_PathGroupListInv.Add(piInv);
            }
            for (ushort i = 0; i < fishDataCount; ++i)
            {
                ResFishData fd = new ResFishData();
                fd.Size = Utility.ReadVec3(br);
                Utility.ReadQuaternion(br);
                for (int j = 0; j < (int)FishClipType.CLIP_MAX; ++j)
                {
                    fd.ClipLength[j] = br.ReadSingle();
                }
                FishResManager.Instance.AddFishData(fd);
            }
            for (ushort i = 0; i < fishGroupCount; ++i)
            {
                GroupDataList gdl = new GroupDataList();
                FishResManager.Instance.AddGroupData(gdl);
                bool bFishPathGroup = br.ReadBoolean();
                if (bFishPathGroup)
                {
                    gdl.PathGroupData = new FishPathGroupData();
                    gdl.PathGroupData.PathGroupIndex = br.ReadUInt16();
                    gdl.PathGroupData.Speed          = br.ReadSingle();
                    gdl.PathGroupData.FishIndex      = br.ReadByte();
                    gdl.PathGroupData.FishScaling    = br.ReadSingle();
                    gdl.PathGroupData.ActionSpeed    = br.ReadSingle();
                    gdl.PathGroupData.ActionUnite    = br.ReadBoolean();
                    //重复次数和间隔
                    br.ReadUInt16();
                    br.ReadUInt16();
                }
                else
                {
                    gdl.FrontPosition = Utility.ReadVec3(br);
                    ushort subPathCount = br.ReadUInt16();
                    gdl.PathList = new ushort[subPathCount];
                    for (ushort j = 0; j < subPathCount; ++j)
                    {
                        gdl.PathList[j] = br.ReadUInt16();
                    }
                    ushort groupDataCount = br.ReadUInt16();
                    gdl.GroupDataArray = new GroupData[groupDataCount];
                    for (ushort j = 0; j < groupDataCount; ++j)
                    {
                        GroupData gd = new GroupData();
                        gd.FishIndex    = br.ReadByte();
                        gd.FishNum      = br.ReadUInt16();
                        gd.FishScaling  = br.ReadSingle();
                        gd.SpeedScaling = br.ReadSingle();
                        gd.ActionSpeed  = br.ReadSingle();
                        gd.ActionUnite  = br.ReadBoolean();
                        gd.PosList      = new Vector3[gd.FishNum];
                        for (int n = 0; n < gd.FishNum; ++n)
                        {
                            gd.PosList[n] = Utility.ReadVec3(br);
                        }
                        gdl.GroupDataArray[j] = gd;
                    }
                }// end if (pd.FishGroupByPathGroup)
            }

            m_BoLang      = ReadPathData(br);
            m_DouDongPath = ReadPathData(br);
            short subPathCount2 = br.ReadInt16();

            m_LongJuanFeng = ReadPathGroupData(br, subPathCount2);

            m_BoLang.SetWorldPosition(Vector3.zero);
            m_DouDongPath.SetWorldPosition(Vector3.zero);

            for (int i = 0; i < m_LongJuanFeng.Length; ++i)
            {
                m_LongJuanFeng[i].SetWorldPosition(Vector3.zero);
            }

            uint endmagic = br.ReadUInt32();

            if (endmagic != ConstValue.FILE_END_MAGIC)
            {
                LogMgr.Log("路径文件结束不正确.");
            }
            br        = null;
            od        = null;
            m_bInitOK = true;
        }
Пример #3
0
 public void AddFishData(ResFishData fd)
 {
     _mFishList.Add(fd);
 }