예제 #1
0
        public void Add(TrackWaypoint wp)
        {
            x_min = Math.Min(wp.X, x_min);
            x_max = Math.Max(wp.X, x_max);

            y_min = Math.Min(wp.Z, y_min);
            y_max = Math.Max(wp.Z, y_max);

            if (wp.Route == TrackRoute.MAIN)
                Racetrack.Add(wp);

            if (wp.Route == TrackRoute.PITLANE)
                Pitlane.Add(wp);
        }
예제 #2
0
        public object Clone()
        {
            TrackWaypoint wp = new TrackWaypoint();

            wp.X = X;
            wp.Y = Y;
            wp.Z = Z;

            wp.Route       = Route;
            wp.Sector      = Sector;
            wp.Meters      = Meters;
            wp.CoordinateL = CoordinateL;
            wp.CoordinateR = CoordinateR;
            wp.PerpVector  = PerpVector;

            return(wp);
        }
예제 #3
0
        public object Clone()
        {
            TrackWaypoint wp = new TrackWaypoint();

            wp.X = X;
            wp.Y = Y;
            wp.Z = Z;

            wp.Route = Route;
            wp.Sector = Sector;
            wp.Meters = Meters;
            wp.CoordinateL = CoordinateL;
            wp.CoordinateR = CoordinateR;
            wp.PerpVector = PerpVector;

            return wp;
        }
예제 #4
0
        public void Add(TrackWaypoint wp)
        {
            x_min = Math.Min(wp.X, x_min);
            x_max = Math.Max(wp.X, x_max);

            y_min = Math.Min(wp.Z, y_min);
            y_max = Math.Max(wp.Z, y_max);

            if (wp.Route == TrackRoute.MAIN)
            {
                Racetrack.Add(wp);
            }

            if (wp.Route == TrackRoute.PITLANE)
            {
                Pitlane.Add(wp);
            }
        }
예제 #5
0
        private void Scan_AIWKey(object d)
        {
            object[] a = (object[]) d;
            string key = (string)a[0];
            string[] values = (string[])a[1];

            switch(key)
            {
                    // pos = coordinates)
                case "Main.wp_pos":

                    // 0=x, 1=0y, 2=z
                    Waypoint_Temp = new TrackWaypoint();

                    Waypoint_Temp.X = Convert.ToDouble(values[0]);
                    Waypoint_Temp.Y = Convert.ToDouble(values[1]);
                    Waypoint_Temp.Z = Convert.ToDouble(values[2]);
                    break;

                    // score = sector, distance
                case "Main.wp_score":
                    Waypoint_Temp.Sector = Convert.ToInt32(values[0]);
                    Waypoint_Temp.Meters = Convert.ToDouble(values[1]);
                    break;

                    // branchID = path ID, 0=main, 1=pitlane
                case "Main.wp_branchid":
                    if (values.Length == 1)
                    {
                        switch (values[0])
                        {
                            case "0":
                                Waypoint_Temp.Route = TrackRoute.MAIN;
                                break;

                            case "1":
                                Waypoint_Temp.Route = TrackRoute.PITLANE;
                                break;

                            default:
                                Waypoint_Temp.Route = TrackRoute.OTHER;
                                break;
                        }
                    }
                    else
                        Waypoint_Temp.Route = TrackRoute.OTHER;
                    break;

                case "Main.wp_perp":

                    Waypoint_Temp.PerpVector = new double[2] { Convert.ToDouble(values[0]), Convert.ToDouble(values[2]) };
                    break;

                case "Main.wp_width":
                    Waypoint_Temp.CoordinateL = new double[2]
                                                    {
                                                        Waypoint_Temp.X - Waypoint_Temp.PerpVector[0]*Convert.ToDouble(values[0]),
                                                        Waypoint_Temp.Z - Waypoint_Temp.PerpVector[1]*Convert.ToDouble(values[0])
                                                    };
                    Waypoint_Temp.CoordinateR = new double[2]
                                                    {
                                                        Waypoint_Temp.X + Waypoint_Temp.PerpVector[0]*Convert.ToDouble(values[1]),
                                                        Waypoint_Temp.Z + Waypoint_Temp.PerpVector[1]*Convert.ToDouble(values[1])
                                                    };
                    break;

                    // ptrs = next path, previous path, pitbox route (-1 for no pitbox), following branchID
                case "Main.wp_ptrs":
                    switch (values[3])
                    {
                        case "0":
                            if (Waypoint_Temp.Route == TrackRoute.MAIN)
                                _Route.Add(Waypoint_Temp);
                            break;
                        case "1":
                            if (Waypoint_Temp.Route == TrackRoute.PITLANE)
                                _Route.Add(Waypoint_Temp);
                            break;
                    }
                    break;

            }
        }