示例#1
0
        /// <summary>
        /// 计算飞行路径(击球)
        /// </summary>
        /// <param name="Input">输入数据</param>
        /// <param name="startPos">发球点</param>
        /// <returns></returns>
        public GolfPathInfo CalcFlyPath(GolfFlyInput input, Vector3 startPos, Vector3 predictionPos)
        {
            FlyInput = input;
            MotionPath.Clear();
            MotionPath.Init();
            //计算球路径
            ClubparameterConfig clubConfig = ClubparameterDao.Inst.GetCfg(FlyInput.ClubType);

            if (clubConfig == null)
            {
                return(null);
            }
            MotionPath.BattingVelocity     = FlyInput.BattingVelocity;
            MotionPath.Fly.CosElevationRad = clubConfig.AngleCos;
            MotionPath.Fly.SinElevationRad = clubConfig.AngleSin;
            MotionPath.SpinValueList.Clear();
            MotionPath.SpinValueList.Add(FlyInput.Spin.FirstFBSpin);
            MotionPath.SpinValueList.Add(FlyInput.Spin.SecondFBSpin);
            MotionPath.SpinValueList.Add(FlyInput.Spin.ThirdFBSpin);
            MotionPath.SpinValueList.Add(FlyInput.Spin.FourFBSpin);
            MotionPath.SpinLeftRight      = FlyInput.Spin.LRSpin;
            MotionPath.HookAngle          = FlyInput.HookAngle;
            MotionPath.Fly.AccuracyRevise = CalcAccuracy(FlyInput.Accuracy.ClubAccuracy, FlyInput.Accuracy.AccuracyOffset);
            MotionPath.SpinDic            = SpinDic;
            MotionPath.CalcPath(startPos, predictionPos, Time.fixedDeltaTime, false);
            return(MotionPath.PathInfo);
        }
示例#2
0
        /// <summary>
        /// 计算,推荐出来的五环的位置
        /// </summary>
        /// <param name="club">所用的球杆</param>
        /// <param name="ball">所使用的球</param>
        /// <param name="startPos">发球点</param>
        /// <returns></returns>
        public Vector3 CalcPredictionRingPos(GolfFlyInput input, Vector3 startPos)
        {
            Vector3 dir = m_CurMap.BallHolePos - startPos;

            dir.Normalize();
            Vector3 RingPos = startPos + dir * (input.ClubStrength + input.BallStrengthPercent / 100);

            FlyInput = input;
            MotionPath.Clear();
            MotionPath.Init();
            //计算球路径
            ClubparameterConfig clubConfig = ClubparameterDao.Inst.GetCfg(FlyInput.ClubType);

            if (clubConfig == null)
            {
                return(RingPos);
            }
            MotionPath.BattingVelocity     = FlyInput.BattingVelocity;
            MotionPath.Fly.CosElevationRad = clubConfig.AngleCos;
            MotionPath.Fly.SinElevationRad = clubConfig.AngleSin;
            MotionPath.SpinValueList.Clear();
            MotionPath.SpinValueList.Add(FlyInput.Spin.FirstFBSpin);
            MotionPath.SpinValueList.Add(FlyInput.Spin.SecondFBSpin);
            MotionPath.SpinValueList.Add(FlyInput.Spin.ThirdFBSpin);
            MotionPath.SpinValueList.Add(FlyInput.Spin.FourFBSpin);
            MotionPath.SpinLeftRight = FlyInput.Spin.LRSpin;
            MotionPath.HookAngle     = FlyInput.HookAngle;
            MotionPath.SpinDic       = SpinDic;
            MotionPath.CalcPath(startPos, RingPos, Time.fixedDeltaTime, false);
            return(RingPos);
        }
示例#3
0
 /// <summary>
 /// 清理操作。
 /// </summary>
 public void Clear()
 {
     m_CurMap = null;
     if (MotionPath != null)
     {
         MotionPath.Clear();
         MotionPath = null;
     }
     if (FlyInput != null)
     {
         FlyInput.Clear();
         FlyInput = null;
     }
     if (PushInput != null)
     {
         PushInput.Clear();
         PushInput = null;
     }
 }