Пример #1
0
    //获取相机动画列表
    private void GetCameraAnimList(SkillCameraData cameraData)
    {
        m_skillAnim.Clear();

        if (cameraData._ShakeAnimName.Length == 1 && cameraData._ShakeAnimName[0] == "0")
        {
            return;
        }

        SkillAnim anim = new SkillAnim();

        for (int i = 0; i < cameraData._ShakeStartTime.Length; i++)
        {
            anim.PlayTime     = cameraData._ShakeStartTime[i] * 0.001f;
            anim.AnimClipName = cameraData._ShakeAnimName[i];
            anim.IsPlayed     = false;
            m_skillAnim.Add(anim);
        }
    }
Пример #2
0
    /// <summary>
    /// 初始化技能镜头世界坐标位置
    /// </summary>
    /// <param name="cameraOffset"></param>
    void InitCameraPosition(SkillCameraData cameraData)
    {
        var cameraOffset = cameraData._CameraOffset;

        if (cameraOffset != Vector3.zero)
        {
            Vector3 offset = Vector3.zero;
            if (cameraData._StartType == 0)   //如果初始类型为0时,为偏移位置
            {
                offset.x = m_playerTrans.position.x + cameraOffset.x *
                           m_playerTrans.forward.x - cameraOffset.z * m_playerTrans.forward.z;
                offset.z = m_playerTrans.position.z + cameraOffset.x *
                           m_playerTrans.forward.z + cameraOffset.z * m_playerTrans.forward.x;
                offset.y = cameraOffset.y;
            }
            else  //如果初始类型为1时,为偏移位置
            {
                offset = cameraData._CameraOffset;
            }
            transform.position = offset;
        }
    }
Пример #3
0
    private static void OnPostprocessSkillCameraConfig()
    {
        string     path = System.IO.Path.Combine(EW_RESOURCE_SKILL_CONFIG_FOLDER, "SkillCamera.xml");
        TextReader tr   = new StreamReader(path);
        string     text = tr.ReadToEnd();

        if (text == null)
        {
            Debug.LogError("Player level config file not exist");
            return;
        }
        else
        {
            XmlSpreadSheetReader.ReadSheet(text);
            XmlSpreadSheet sheet = XmlSpreadSheetReader.Output;
            string[]       keys  = XmlSpreadSheetReader.Keys;

            object[] levelIds = sheet[keys[0]];

            List <SkillCameraData> tempList = new List <SkillCameraData>();

            for (int i = 2; i < levelIds.Length; i++)
            {
                SkillCameraData data = new SkillCameraData();
                data._CameraID       = Convert.ToInt32(sheet["CameraID"][i]);
                data._CameraDuration = Convert.ToSingle(sheet["CameraDuration"][i]);
                data._StartType      = Convert.ToInt32(sheet["CameraStartType"][i]);

                string[] startOffset = Convert.ToString(sheet["CameraStartPos"][i]).Split('+');
                data._CameraOffset = new Vector3(Convert.ToInt32(startOffset[1]), Convert.ToInt32(startOffset[2]), Convert.ToInt32(startOffset[3]));

                string[] targetOffset = Convert.ToString(sheet["CameraTargetPos"][i]).Split('+');
                data._TargetOffset = new Vector3(Convert.ToInt32(targetOffset[1]), Convert.ToInt32(targetOffset[2]), Convert.ToInt32(targetOffset[3]));

                data._CameraType = Convert.ToInt32(sheet["CameraMoveType"][i]);

                string[] cameraParamsStr = Convert.ToString(sheet["CameraMoveNumber"][i]).Split('|');
                data._CameraParams = new SkillCameraParam[cameraParamsStr.Length];

                for (int j = 0; j < cameraParamsStr.Length; j++)
                {
                    data._CameraParams[j] = new SkillCameraParam();
                    string[] itemParamStr = Convert.ToString(cameraParamsStr[j]).Split('+');
                    if (itemParamStr.Length == 3)
                    {
                        data._CameraParams[j]._EquA = Convert.ToSingle(itemParamStr[1]);
                        data._CameraParams[j]._EquB = Convert.ToSingle(itemParamStr[2]);
                    }
                }

                data._CameraResetTime = Convert.ToSingle(sheet["CameraEndTime"][i]);
                string[] shakeTimeStr = Convert.ToString(sheet["ShakeStartTime"][i]).Split('+');
                data._ShakeStartTime = new float[shakeTimeStr.Length];
                for (int j = 0; j < shakeTimeStr.Length; j++)
                {
                    data._ShakeStartTime[j] = Convert.ToSingle(shakeTimeStr[j]);
                }

                data._ShakeAnimName = Convert.ToString(sheet["ShakeDoc"][i]).Split('+');

                tempList.Add(data);
            }

            CreateSkillCameraDataBase(tempList);
        }
    }