Exemplo n.º 1
0
 /// <summary>
 /// 构建4叉树
 /// </summary>
 public void Create(List <Index2> listAB, GolfCourseMap map)
 {
     if (listAB == null || listAB.Count == 0)
     {
         return;
     }
     if (listAB.Count <= MaxCount)
     {
         m_SelfList = new List <Index2>();
         m_SelfList.AddRange(listAB);
     }
     else
     {
         Vector2 cc = (this.AA2 + this.BB2) * 0.5f;
         m_UpLeftTree    = new QuadTree(this.AA2, cc);
         m_UpRightTree   = new QuadTree(new Vector2(cc.x, this.AA2.y), new Vector2(this.BB2.x, cc.y));
         m_DownLeftTree  = new QuadTree(new Vector2(this.AA2.x, cc.y), new Vector2(cc.x, this.BB2.y));
         m_DownRightTree = new QuadTree(cc, this.BB2);
         List <Index2> lUpLeft    = new List <Index2>();
         List <Index2> lUpRight   = new List <Index2>();
         List <Index2> lDownLeft  = new List <Index2>();
         List <Index2> lDownRight = new List <Index2>();
         for (int i = 0; i < listAB.Count; i++)
         {
             GolfMaptriangle tri = map.GetMapTriangle(listAB[i]);
             if (tri == null)
             {
                 continue;
             }
             if (m_UpLeftTree.CheckProjectionContains(tri) == true)
             {
                 lUpLeft.Add(listAB[i]);
             }
             if (m_UpRightTree.CheckProjectionContains(tri) == true)
             {
                 lUpRight.Add(listAB[i]);
             }
             if (m_DownLeftTree.CheckProjectionContains(tri) == true)
             {
                 lDownLeft.Add(listAB[i]);
             }
             if (m_DownRightTree.CheckProjectionContains(tri) == true)
             {
                 lDownRight.Add(listAB[i]);
             }
         }
         CreateSubTree(ref m_UpLeftTree, ref lUpLeft, map);
         CreateSubTree(ref m_UpRightTree, ref lUpRight, map);
         CreateSubTree(ref m_DownLeftTree, ref lDownLeft, map);
         CreateSubTree(ref m_DownRightTree, ref lDownRight, map);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 构建4叉树
 /// </summary>
 public void CreateSubTree(ref QuadTree tree, ref List <Index2> listAB, GolfCourseMap map)
 {
     if (tree == null)
     {
         return;
     }
     if (listAB.Count > 0)
     {
         tree.Create(listAB, map);
     }
     else
     {
         tree = null;
     }
     listAB.Clear();
     listAB = null;
 }
Exemplo n.º 3
0
 public GolfPath(GolfCourseMap map)
 {
     m_CurMap   = map;
     MotionPath = new GolfMotionPath(map);
     SpinDic    = new Dictionary <int, List <float> >();
     //旋球临时数据
     for (int j = 0; j < 4; j++)
     {
         List <float> spinList = new List <float>();
         spinList.Clear();
         for (int i = 1; i <= 5; i++)
         {
             GroundmaterialConfig groundMatConfig = GroundmaterialDao.Inst.GetCfg((uint)i);
             spinList.Add(groundMatConfig.SpinAddition1);
         }
         SpinDic.Add(j, spinList);
     }
 }
Exemplo n.º 4
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;
     }
 }
Exemplo n.º 5
0
 public GolfMotionRoll(GolfCourseMap map)
 {
     m_CurMap     = map;
     m_HoleRadius = m_CurMap.BallHoleRadius;
 }
Exemplo n.º 6
0
 public GolfPathInfo(GolfCourseMap map)
 {
     m_CurMap = map;
 }