Beispiel #1
0
        /// <summary>
        /// 模拟数据
        /// </summary>
        public static void SimulationData()
        {
            MapData data = MapData.Load();

            g_BattleMap = new GolfCourseMap(data);
            g_BattleMap.BuildMap();


            g_SelClub             = new ClubInfo();
            g_SelClub.ID          = 10001;
            g_SelClub.Type        = 5;
            g_SelClub.Strength    = 190;
            g_SelClub.Accuracy    = 10;
            g_SelClub.ForwardSpin = 0;
            g_SelClub.BackSpin    = 0;
            g_SelClub.Hook        = 5;

            g_SelBall    = new BallInfo();
            g_SelBall.ID = 10001;
            g_SelBall.StrengthPercent = 0;
            g_SelBall.windRevise      = 0;
            g_SelBall.LRSpin          = 0;

            //GolfMapFlyCollision collision = null;
            //Vector3 s = new Vector3(250.0f, 0.0f, 25.0f);
            //Vector3 e = new Vector3(250.0f, -0.01125f, 25.0f);
            //g_BattleMap.CheckCollisionPoint(s, e, ref collision);
        }
Beispiel #2
0
 /// <summary>
 /// 根据地图数据加载地图
 /// </summary>
 /// <param name="map"></param>
 public void LoadMap2Ball(GolfCourseMap map)
 {
     if (map == null)
     {
         return;
     }
     ResourceManger.LoadMap("GolfMap", transform, false, false, (g) =>
     {
         if (g != null)
         {
             GolfRuler ruler = g.AddComponent <GolfRuler>();
             ruler.SetAABB(map.AA2, map.BB2);
         }
     });
     ResourceManger.LoadBall("GolfBall", transform, false, false, (ballGo) =>
     {
         if (ballGo != null)
         {
             GolfBall ball = ballGo.GetComponent <GolfBall>();
             if (ball == null)
             {
                 ball = ballGo.AddComponent <GolfBall>();
             }
             if (ball != null)
             {
                 ball.SetBallPos(map.StartPos);
             }
         }
     });
 }
Beispiel #3
0
        public static void ClearDC()
        {
            //退到登陆界面时执行
            if (g_BattleMap != null)
            {
                g_BattleMap.Clear();
                g_BattleMap = null;
            }

            if (g_SelClub != null)
            {
                g_SelClub = null;
            }

            if (g_SelBall != null)
            {
                g_SelBall = null;
            }
        }