/// <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; } }
/// <summary> /// 计算滚动路径(推杆) /// </summary> /// <param name="input">输入数据</param> /// <param name="startPos">发球点</param> /// <returns></returns> public GolfPathInfo CalcRollPath(GolfPushInput input, Vector3 startPos, Vector3 predictionPos) { PushInput = input; MotionPath.Clear(); MotionPath.Init(); MotionPath.PathInfo.ListPt.Clear(); GolfRollPoint rollPoint = new GolfRollPoint(); rollPoint.Position = startPos; SearchResult sr = null; m_CurMap.SearchMapTriangle(rollPoint.Position, ref sr); rollPoint.Velocity = PushInput.BattingVelocity; rollPoint.IsRoll = true; rollPoint.Poly = sr.Poly; rollPoint.AType = sr.Type; rollPoint.ColType = CollisionType.Normal; rollPoint.Status = BallRunStatus.Roll; MotionPath.PathInfo.AddPathPoint(rollPoint); MotionPath.CalcPath(startPos, predictionPos, Time.fixedDeltaTime, true); return(MotionPath.PathInfo); }