public virtual IVehicle Build(DrivingStyle style,
     VehicleColour colour)
 {
     IVehicle v = SelectVehicle(style);
     v.Paint(colour);
     return v;
 }
 public static IVehicle MakeVehicle(Category category, DrivingStyle style,
     VehicleColour colour)
 {
     return category == Category.Van
         ? new VanFactory().Build(style, colour)
         : new CarFactory().Build(style, colour);
 }
Exemple #3
0
 protected internal override IVehicle SelectVehicle(DrivingStyle style)
 {
     if (style == DrivingStyle.Economical || style == DrivingStyle.Midrange)
     {
         return(new Pickup(new StandardEngine(2200)));
     }
     else
     {
         return(new BoxVan(new StandardEngine(2500)));
     }
 }
Exemple #4
0
        protected override IVehicle SelectVehicle(DrivingStyle style)
        {
            switch (style)
            {
            case DrivingStyle.Economical:
            case DrivingStyle.Midrange:
                return(new BoxVan(new StandardEngine(1600)));

            default:
                return(new PickUp(new TurboEngine(2000)));
            }
        }
 protected internal override IVehicle SelectVehicle(DrivingStyle style)
 {
     switch (style)
     {
         case DrivingStyle.Midrange:
             return new BoxVan(new StandardEngine(200));
         case DrivingStyle.Powerful:
             return new Pickup(new TurboEngine(3000));
         default:
             return null;
     }
 }
        protected internal override IVehicle SelectVehicle(DrivingStyle style)
        {
            switch (style)
            {
            case DrivingStyle.Economical:
                return(new Saloon(new StandardEngine(1300)));

            case DrivingStyle.Midrange:
                return(new Coupe(new StandardEngine(1600)));
            }

            return(new Sport(new StandardEngine(2000)));
        }
Exemple #7
0
        protected override IVehicle SelectVehicle(DrivingStyle style)
        {
            switch (style)
            {
            case DrivingStyle.Midrange:
                return(new Coupe(new StandardEngine(1600)));

            case DrivingStyle.Powerful:
                return(new Sport(new TurboEngine(2000)));

            default:
                return(new Saloon(new StandardEngine(1300)));
            }
        }
 protected internal override IVehicle SelectVehicle(DrivingStyle style)
 {
     switch (style)
     {
         case DrivingStyle.Economical:
             return new Saloon(new StandardEngine(1200));
         case DrivingStyle.Midrange:
             return new Coupe(new StandardEngine(1800));
         case DrivingStyle.Powerful:
             return new Sport(new TurboEngine(4000));
         default:
             return null;
     }
 }
Exemple #9
0
        public static IVehicle Make(Category category, DrivingStyle style, VehicleColour colour)
        {
            VehicleFactory factory;

            if (category == Category.Car)
            {
                factory = new CarFactory();
            }
            else
            {
                factory = new VanFactory();
            }

            return(factory.Build(style, colour));
        }
Exemple #10
0
 protected internal override IVehicle SelectVehicle(DrivingStyle style)
 {
     if (style == DrivingStyle.Economical)
     {
         return(new Saloon(new StandardEngine(1300)));
     }
     else if (style == DrivingStyle.Midrange)
     {
         return(new Coupe(new StandardEngine(1600)));
     }
     else
     {
         return(new Sport(new TurboEngine(2000)));
     }
 }
Exemple #11
0
        protected internal override IVehicle SelectVehicle(DrivingStyle style)
        {
            IVehicle selectedVehicle;

            if ((style == DrivingStyle.Economical) ||
                (style == DrivingStyle.Midrange))
            {
                selectedVehicle = new Pickup(new StandardEngine(2200));

            }
            else
            {
                selectedVehicle = new BoxVan(new TurboEngine(2500));
            }

            return selectedVehicle;
        }
        protected internal override IVehicle SelectVehicle
            (DrivingStyle style)
        {
            IVehicle selectedVehicle;

            if ((style == DrivingStyle.Economical) ||
                (style == DrivingStyle.Midrange))
            {
                selectedVehicle = new Pickup(new StandardEngine(2200));
            }
            else
            {
                selectedVehicle = new BoxVan(new TurboEngine(2500));
            }

            return(selectedVehicle);
        }
Exemple #13
0
        public static IVehicle Make(Category category, DrivingStyle drivingStyle, VehicleColour vehicleColour)
        {
            VehicleFactory factory;

            switch (category)
            {
            case Category.Car:
                factory = new CarFactory();
                break;

            default:
                factory = new VanFactory();
                break;
            }

            return(factory.Build(drivingStyle, vehicleColour));
        }
 protected internal override IVehicle SelectVehicle(DrivingStyle style)     
 {
            
     if ((style == DrivingStyle.Economical) || (style == DrivingStyle.Midrange))
     {
                     
         return(new Pickup(new StandardEngine(2200)));        
     }
             
     else
     {
                 
         {
                         
             return(new BoxVan(new TurboEngine(2500)));         
         }
     }    
 }
        public static IVehicle Make(Category cat,
            DrivingStyle style,
            VehicleColour colour)
        {
            VehicleFactory factory;

            if (cat == Category.Car)
            {
                factory = new CarFactory();

            }
            else
            {
                factory = new VanFactory();
            }

            return factory.Build(style, colour);
        }
Exemple #16
0
        protected internal override IVehicle SelectVehicle(DrivingStyle style)
        {
            IVehicle selectedVehicle;

            if (style == DrivingStyle.Economical)
            {
                selectedVehicle = new Saloon(new StandardEngine(1300));

            }
            else if (style == DrivingStyle.Midrange)
            {
                selectedVehicle = new Coupe(new StandardEngine(1600));

            }
            else
            {
                selectedVehicle = new Sport(new TurboEngine(2000));
            }

            return selectedVehicle;
        }
Exemple #17
0
        private static IVehicle GetFactory(VehicleType type, DrivingStyle style, VehicleColour colour)
        {
            VehicleFactory factory;

            switch (type)
            {
            case VehicleType.Car:
                factory = new CarVehicleFactory();
                break;

            case VehicleType.Van:
                factory = new CarVehicleFactory();
                break;

            default:
                factory = null;
                break;
            }

            return(factory.Build(type, colour));
        }
Exemple #18
0
        private async Task GetDriverStileAsync()
        {
            if (DesignMode.DesignModeEnabled)
            {
                _styleDriver = new DrivingStyle
                {
                    DID = "1",
                    CurrentDrivingStyle = 67,
                    CurrentEcoStyle     = 89,
                    TodayDrivingScore   = 58,
                    TodayEcoScore       = 68,
                    TotalDrivingScore   = 68,
                    TotalEcoScore       = 98
                }
            }
            ;
            var res = await TcpConnection.Send("BH" + CarId);

            if (!string.IsNullOrEmpty(res.Msg))
            {
                await Split(res.Fx, res.Msg);
            }
        }
Exemple #19
0
        public static IVehicle Make
        (
            BuildWhat aBuildWhat
            , DrivingStyle aDrivingStyle
            , VehicleColour aVehicleColour
        )
        {
            switch (aBuildWhat)
            {
            case BuildWhat.Car:
            {
                Factory = new CarFactory();
                break;
            }

            case BuildWhat.Van:
            {
                Factory = new VanFactory();
                break;
            }
            }
            return(Factory.Build(aDrivingStyle, aVehicleColour));
        }
Exemple #20
0
        public bool Equals(AutoPilot other)
        {
            if (other == null)
            {
                return(false);
            }

            return(CurrRouteNode.Equals(other.CurrRouteNode) &&
                   NextRouteNode.Equals(other.NextRouteNode) &&
                   PrevRouteNode.Equals(other.PrevRouteNode) &&
                   TimeEnteredCurve.Equals(other.TimeEnteredCurve) &&
                   TimeToSpendOnCurrentCurve.Equals(other.TimeToSpendOnCurrentCurve) &&
                   CurrPathNodeInfo.Equals(other.CurrPathNodeInfo) &&
                   NextPathNodeInfo.Equals(other.NextPathNodeInfo) &&
                   PrevPathNodeInfo.Equals(other.PrevPathNodeInfo) &&
                   AntiReverseTimer.Equals(other.AntiReverseTimer) &&
                   TimeToStartMission.Equals(other.TimeToStartMission) &&
                   PrevDirection.Equals(other.PrevDirection) &&
                   CurrDirection.Equals(other.CurrDirection) &&
                   NextDirection.Equals(other.NextDirection) &&
                   CurrLane.Equals(other.CurrLane) &&
                   NextLane.Equals(other.NextLane) &&
                   DrivingStyle.Equals(other.DrivingStyle) &&
                   Mission.Equals(other.Mission) &&
                   TempAction.Equals(other.TempAction) &&
                   TimeTempAction.Equals(other.TimeTempAction) &&
                   MaxTrafficSpeed.Equals(other.MaxTrafficSpeed) &&
                   CruiseSpeed.Equals(other.CruiseSpeed) &&
                   SlowedDownByCars.Equals(other.SlowedDownByCars) &&
                   SlowedDownByPeds.Equals(other.SlowedDownByPeds) &&
                   StayInCurrentLevel.Equals(other.StayInCurrentLevel) &&
                   StayInFastLane.Equals(other.StayInFastLane) &&
                   IgnorePathFinding.Equals(other.IgnorePathFinding) &&
                   Destination.Equals(other.Destination) &&
                   PathFindNodesCount.Equals(other.PathFindNodesCount));
        }
Exemple #21
0
 private async Task Split(char fx, string msg, bool fillEnd = false)
 {
     try
     {
         if (fx == 'N' || fx == 'n')
         {
             foreach (var el in JsonConvert.DeserializeObject <TimeModel[]>(msg).Where(el => ListStartPoint.IndexOf(el) < 0))
             {
                 if (fillEnd)
                 {
                     ListEndPoint.Add(el);
                 }
                 else
                 {
                     ListStartPoint.Add(el);
                 }
             }
         }
         if (fx == 'M' || fx == 'm')
         {
             TripModel = (JsonConvert.DeserializeObject <TripAdvisorModel[]>(msg)).FirstOrDefault(o => o.DID.Equals(CarId));
         }
         //foreach (var el in JsonConvert.DeserializeObject<TripAdvisorModel[]>(msg))
         //{
         //    ListTrip.Add(new TripAdvisorViewModel(el));
         //}
         if (fx == 'H' || fx == 'h')
         {
             var res = JsonConvert.DeserializeObject <DrivingStyle[]>(msg);
             _styleDriver = res.FirstOrDefault(o => o.DID.Equals(CarId));
         }
     }
     catch (Exception)
     {
     }
 }
Exemple #22
0
 public void DriveTo(Vehicle vehicle, Vector3 target, float radius, float speed, DrivingStyle style = DrivingStyle.Normal)
 {
     Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, _ped.Handle, vehicle.Handle, target.X, target.Y, target.Z, speed, style, radius);
 }
Exemple #23
0
 public void CruiseWithVehicle(Vehicle vehicle, float speed, DrivingStyle style = DrivingStyle.Normal)
 {
     Function.Call(Hash.TASK_VEHICLE_DRIVE_WANDER, _ped.Handle, vehicle.Handle, speed, style);
 }
Exemple #24
0
 protected abstract IVehicle SelectVehicle(DrivingStyle style);
Exemple #25
0
 //This is factory method
 protected internal abstract IVehicle SelectVehicle(DrivingStyle style);
Exemple #26
0
        public void ItemSelectHandler(UIMenu sender, UIMenuItem selectedItem, int index)
        {
            if (sender == mainMenu)
            {
                switch (index)
                {
                case 0:
                    if (player.IsInVehicle())
                    {
                        UI.Notify("Cannot Start Race In Vehicle.");
                    }
                    else
                    {
                        active1 = true;
                        setWaypoint(custom1x, custom1y);
                        waypointSet = true;
                        var playerPos = player.Position;

                        player.Position = new Vector3(-855, 159, 64);
                        player.Heading  = 85;

                        Vector3 coords = player.GetOffsetInWorldCoords(playerPos);
                        Wait(210);
                        Vehicle playerVeh = World.CreateVehicle(selectedCarHash, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)));
                        Wait(250);
                        Vehicle PedVehicle = World.CreateVehicle(selectedCarHash, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 10, 0)));
                        Function.Call(Hash.CREATE_RANDOM_PED_AS_DRIVER, PedVehicle, true);
                        Wait(500);
                        player.SetIntoVehicle(playerVeh, VehicleSeat.Driver);
                        Ped     PedDriver = PedVehicle.GetPedOnSeat(VehicleSeat.Driver);
                        Vector3 waypoint1 = new Vector3(-1815, 96, 73);

                        DrivingStyle crazy  = DrivingStyle.Rushed;
                        int          crazy1 = Convert.ToInt32(crazy);
                        PedDriver.Task.DriveTo(PedVehicle, new Vector3(custom1x, custom1y, custom1z), 0, maxSpeed, crazy1);
                        //blip1.ShowRoute = true;
                    }
                    break;

                case 1:

                    if (player.IsInVehicle())
                    {
                        UI.Notify("Cannot Start Race In Vehicle.");
                    }
                    else
                    {
                        active2 = true;
                        setWaypoint(custom2x, custom2y);
                        waypointSet = true;
                        Wait(210);
                        Vehicle playerVeh = World.CreateVehicle(selectedCarHash, new Vector3(-248, -1148, 22), 270);
                        Wait(250);
                        Vehicle PedVehicle = World.CreateVehicle(selectedCarHash, new Vector3(-241, -1143, 22), 270);
                        Function.Call(Hash.CREATE_RANDOM_PED_AS_DRIVER, PedVehicle, true);
                        Wait(500);
                        player.SetIntoVehicle(playerVeh, VehicleSeat.Driver);
                        Ped          PedDriver = PedVehicle.GetPedOnSeat(VehicleSeat.Driver);
                        DrivingStyle crazy     = DrivingStyle.Rushed;
                        int          crazy1    = Convert.ToInt32(crazy);
                        PedDriver.Task.DriveTo(PedVehicle, new Vector3(custom2x, custom2y, custom2z), 0, maxSpeed, crazy1);
                        //blip1.ShowRoute = true;
                    }

                    break;

                case 2:
                    if (player.IsInVehicle())
                    {
                        UI.Notify("Cannot Start Race In Vehicle.");
                    }
                    else
                    {
                        active3 = true;
                        setWaypoint(custom3x, custom3y);
                        waypointSet = true;
                        Wait(210);
                        Vehicle playerVeh = World.CreateVehicle(selectedCarHash, new Vector3(customs3x, customs3y, customs3z), customh3);
                        Wait(250);
                        Vector3 offset     = playerVeh.GetOffsetInWorldCoords(new Vector3(5, 0, 0));
                        Vehicle PedVehicle = World.CreateVehicle(selectedCarHash, offset, customh3);
                        Function.Call(Hash.CREATE_RANDOM_PED_AS_DRIVER, PedVehicle, true);
                        Wait(500);
                        player.SetIntoVehicle(playerVeh, VehicleSeat.Driver);
                        Ped          PedDriver = PedVehicle.GetPedOnSeat(VehicleSeat.Driver);
                        DrivingStyle crazy     = DrivingStyle.Rushed;
                        int          crazy1    = Convert.ToInt32(crazy);
                        PedDriver.Task.DriveTo(PedVehicle, new Vector3(custom3x, custom3y, custom3z), 0, maxSpeed, crazy1);
                        //blip1.ShowRoute = true;
                    }
                    break;

                case 3:
                    bool isReady = false;
                    if (player.IsInVehicle())
                    {
                        UI.Notify("Cannot Start Race In Vehicle.");
                    }
                    else
                    {
                        Vector3 dest = new Vector3();
                        if (Function.Call <bool>(Hash.IS_WAYPOINT_ACTIVE))
                        {
                            dest    = GetWaypointCoords();
                            isReady = true;
                        }
                        else
                        {
                            UI.ShowSubtitle("Waypoint not set");
                        }
                        if (isReady)
                        {
                            active4 = true;
                            Wait(210);
                            Vehicle playerVeh = World.CreateVehicle(selectedCarHash, player.GetOffsetInWorldCoords(new Vector3(0, 5, 0)));
                            Wait(250);
                            Vector3 offset     = playerVeh.GetOffsetInWorldCoords(new Vector3(5, 0, 0));
                            Vehicle PedVehicle = World.CreateVehicle(selectedCarHash, offset);
                            Function.Call(Hash.CREATE_RANDOM_PED_AS_DRIVER, PedVehicle, true);
                            Wait(500);
                            player.SetIntoVehicle(playerVeh, VehicleSeat.Driver);
                            Ped          PedDriver = PedVehicle.GetPedOnSeat(VehicleSeat.Driver);
                            DrivingStyle crazy     = DrivingStyle.Rushed;
                            int          crazy1    = Convert.ToInt32(crazy);
                            PedDriver.Task.DriveTo(PedVehicle, dest, 0, maxSpeed, crazy1);
                        }
                    }
                    break;
                }
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="locations"></param>
 /// <param name="routeType"></param>
 /// <param name="drivingStyle"></param>
 /// <param name="avoids"></param>
 /// <param name="enhancedNarrative"></param>
 /// <param name="metric"></param>
 /// <param name="fuelEfficiency"></param>
 /// <returns></returns>
 public static Directions getDirections(List<Locations> locations, StaticMap.MapType mapType, RouteType routeType = RouteType.Fastest, DrivingStyle drivingStyle = DrivingStyle.Normal, List<Avoids> avoids = null, bool enhancedNarrative = false, bool metric = false, int fuelEfficiency = 21)
 {
     if (locations.Count == 0)
         return new Directions();
     if (locations.Count == 1)
     {
         //Front end request an empty direction with the map of the location
         Directions d = new Directions();
         d.mainMap = locations[0].map;
         d.mapDetails = locations[0].mapDetails;
         d.mapDetails.mapType = mapType;
         d.legs.Add(new Leg());
         d.legs[0].maneuvers.Add(new Maneuver());
         return d;
     }
     WebClient w = new WebClient();
     string url = ConfigurationManager.AppSettings["MapQuestDirectionsURL"] + ConfigurationManager.AppSettings["MapQuestAPIKey"];
     if (avoids != null)
     {
         foreach (Avoids a in avoids)
             switch (a)
             {
                 case Avoids.CountryBorderCrossing:
                     url += "&avoids=Country border";
                     break;
                 case Avoids.Ferry:
                     url += "&avoids=Ferry";
                     break;
                 case Avoids.LimitedAccess:
                     url += "&avoids=Limited Access";
                     break;
                 case Avoids.SeasonalClosure:
                     url += "&avoids=Approximate Seasonal Closure";
                     break;
                 case Avoids.TollRoad:
                     url += "&avoids=Toll road";
                     break;
                 case Avoids.Unpaved:
                     url += "&avoids=Unpaved";
                     break;
                 default:
                     break;
             }
     }
     url += "&outFormat=json";
     switch (routeType)
     {
         case RouteType.Fastest:
             url += "&routeType=fastest";
             break;
         case RouteType.Shortest:
             url += "&routeType=shortest";
             break;
         case RouteType.Pedestrian:
             url += "&routeType=pedestrian";
             break;
         case RouteType.Bicycle:
             url += "&routeType=bicycle";
             break;
         case RouteType.Multimodal:
             url += "&routeType=multimodal";
             break;
         default:
             url += "&routeType=fastest";
             break;
     }
     url += "&timeType=1";
     url += (enhancedNarrative ? "&enhancedNarrative=true" : "&enhancedNarrative=false");
     url += "&shapeFormat=raw&generalize=0";
     url += ConfigurationManager.AppSettings["MapQuestDirectionsLocale"];
     url += (metric ? "&unit=k" : "&unit=m");
     for (int i = 1; i < locations.Count; ++i)
     {
         url += ("&from=" + locations[i - 1].latLng.lat + ',' + locations[i - 1].latLng.lng
             + "&to=" + locations[i].latLng.lat + ',' + locations[i].latLng.lng);
     }
     url += "&drivingStyle=";
     switch (drivingStyle)
     {
         case DrivingStyle.Aggressive:
             url += "3";
             break;
         case DrivingStyle.Cautious:
             url += "1";
             break;
         case DrivingStyle.Normal:
             url += "2";
             break;
         default:
             url += "2";
             break;
     }
     url += "&highwayEfficiency=" + fuelEfficiency;
     JsonSerializerSettings s = new JsonSerializerSettings();
     s.NullValueHandling = NullValueHandling.Ignore;
     s.ObjectCreationHandling = ObjectCreationHandling.Replace;
     Directions result = JsonConvert.DeserializeObject<DirectionsRootObject>(w.DownloadString(url), s).route;
     result.mapDetails.mapType = mapType;
     return result;
 }
Exemple #28
0
 public void DriveTo(Vehicle vehicle, Vector3 target, float radius, float speed, DrivingStyle style = 0xc00ab)
 {
     InputArgument[] arguments = new InputArgument[] { this._ped.Handle, vehicle.Handle, target.X, target.Y, target.Z, speed, style, radius };
     Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, arguments);
 }
Exemple #29
0
 public void CruiseWithVehicle(Vehicle vehicle, float speed, DrivingStyle style = 0xc00ab)
 {
     InputArgument[] arguments = new InputArgument[] { this._ped.Handle, vehicle.Handle, speed, style };
     Function.Call(Hash.TASK_VEHICLE_DRIVE_WANDER, arguments);
 }
Exemple #30
0
        private void Main_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (Mod_Active)
            {
                if (e.KeyCode == System.Windows.Forms.Keys.X)
                {
                    Player_Ped = GTA.Game.Player.Character;
                    //UI.ShowSubtitle("Mod Activated : " + Mod_Name);
                    if (Player_Ped != null)
                    {
                        if (Player_Ped.IsOnFoot)
                        {
                            var nearest_vehicle = World.GetNearbyVehicles(Player_Ped.Position, 4f);

                            for (int i = 0; i < nearest_vehicle.Length; i++)
                            {
                                if (nearest_vehicle[i] != null)
                                {
                                    if (nearest_vehicle[i].GetPedOnSeat(VehicleSeat.Driver) != null && nearest_vehicle[i].IsSeatFree(VehicleSeat.Any))
                                    {
                                        all_peds.Add(nearest_vehicle[i].GetPedOnSeat(VehicleSeat.Driver));
                                        foreach (var item in nearest_vehicle[i].Passengers.ToList())
                                        {
                                            all_peds.Add(item);
                                        }

                                        foreach (var item in all_peds)
                                        {
                                            World.SetRelationshipBetweenGroups(Relationship.Like, item.RelationshipGroup, Player_Ped.RelationshipGroup);
                                            Function.Call(GTA.Native.Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, item, 1);
                                            Function.Call(GTA.Native.Hash.SET_PED_COMBAT_ATTRIBUTES, item, 20, true);
                                        }
                                        nearest_vehicle[i].GetPedOnSeat(VehicleSeat.Driver).Task.Wait(5000);
                                        UI.ShowSubtitle("Nearest Vehicle is : " + nearest_vehicle[i].DisplayName);
                                        if (nearest_vehicle[i].IsSeatFree(VehicleSeat.RightRear))
                                        {
                                            Player_Ped.Task.EnterVehicle(nearest_vehicle[i], VehicleSeat.RightRear, -1, 10f);
                                            vehicle_set = true;
                                        }
                                        else if (nearest_vehicle[i].IsSeatFree(VehicleSeat.LeftRear))
                                        {
                                            Player_Ped.Task.EnterVehicle(nearest_vehicle[i], VehicleSeat.LeftRear, -1, 10f);
                                            vehicle_set = true;
                                        }
                                        else if (nearest_vehicle[i].IsSeatFree(VehicleSeat.Passenger))
                                        {
                                            Player_Ped.Task.EnterVehicle(nearest_vehicle[i], VehicleSeat.Passenger, -1, 10f);
                                            vehicle_set = true;
                                        }
                                        else
                                        {
                                            UI.ShowSubtitle("No Seat Available");
                                            foreach (var item in all_peds)
                                            {
                                                item.MarkAsNoLongerNeeded();
                                            }
                                        }
                                        break;
                                    }
                                }
                            }
                        }

                        if (Give_Tip && vehicle_set)
                        {
                            if (all_peds.Count > 0)
                            {
                                if (!Player_Ped.IsOnFoot)
                                {
                                    if (Player_Ped.CurrentVehicle != null)
                                    {
                                        if (Player_Ped.CurrentVehicle == all_peds[0].CurrentVehicle)
                                        {
                                            ridetime_started = Game.GameTime;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                //increase speed
                if (e.KeyCode == System.Windows.Forms.Keys.Right && vehicle_set)
                {
                    if (speed < 50)
                    {
                        speed++;
                    }
                    Set_Destination_Marker_Map();
                    if (Destionation != null)
                    {
                        Player_Ped.CurrentVehicle.Driver.Task.DriveTo(Player_Ped.CurrentVehicle, Destionation, 4f, speed, (int)driving_style);
                    }
                    else
                    {
                        Player_Ped.CurrentVehicle.Driver.Task.CruiseWithVehicle(Player_Ped.CurrentVehicle, speed, (int)driving_style);
                    }

                    GTA.UI.ShowSubtitle("Speed increased to : " + speed);
                }

                //decrease speed
                if (e.KeyCode == System.Windows.Forms.Keys.Left && vehicle_set)
                {
                    if (speed > 1)
                    {
                        speed--;
                    }

                    Set_Destination_Marker_Map();
                    if (Destionation != null)
                    {
                        Player_Ped.CurrentVehicle.Driver.Task.DriveTo(Player_Ped.CurrentVehicle, Destionation, 4f, speed, (int)driving_style);
                    }
                    else
                    {
                        Player_Ped.CurrentVehicle.Driver.Task.CruiseWithVehicle(Player_Ped.CurrentVehicle, speed, (int)driving_style);
                    }
                    GTA.UI.ShowSubtitle("Speed decreased to : " + speed);
                }

                //change driving mode Normal/Rushed
                if (e.KeyCode == System.Windows.Forms.Keys.OemPeriod)
                {
                    if (driving_style == DrivingStyle.Normal)
                    {
                        driving_style = DrivingStyle.Rushed;
                    }
                    else
                    {
                        driving_style = DrivingStyle.Normal;
                    }
                    GTA.UI.Notify("Driving Style set to : " + driving_style);
                }

                if (vehicle_set && e.KeyCode == System.Windows.Forms.Keys.F)
                {
                    if (Give_Tip)
                    {
                        int ridetime_ended        = Game.GameTime - ridetime_started;
                        int minimum_Money_Balance = (Game.Player.Money * 10) / 100;

                        if (minimum_Money_Balance < 100)
                        {
                            minimum_Money_Balance = 100;
                        }

                        if (Game.Player.Money > minimum_Money_Balance)
                        {
                            UI.Notify("Ride time is : " + ridetime_ended.ToString());
                            UI.Notify("Minimum Money Balance : " + minimum_Money_Balance.ToString());
                        }
                        else
                        {
                            UI.Notify("Reached there : " + ridetime_ended.ToString());
                        }
                    }

                    if (all_peds.Count > 0)
                    {
                        foreach (var item in all_peds)
                        {
                            item.MarkAsNoLongerNeeded();
                        }
                        all_peds.Clear();
                        GTA.UI.Notify("Cleared everything");
                    }

                    vehicle_set = false;
                }
            }
        }
 public virtual IVehicle Build(DrivingStyle style, VehicleColour colour)
 {
     var vehicle = SelectVehicle(style);
     vehicle.Paint(colour);
     return vehicle;
 }
Exemple #32
0
 public static void DriveToCoord(Ped driver, Vehicle vehicle, Vector3 destination, float speed, DrivingStyle drivingStyle)
 {
     Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, driver, vehicle,
                   destination.X, destination.Y, destination.Z, speed * 0.44704f, 5f, vehicle.GetHashCode(), drivingStyle, 1f, true);
 }
 /// <summary>
 /// 指定地に乗り物を移動させる
 /// </summary>
 /// <param name="vehicle"></param>
 /// <param name="ped"></param>
 /// <param name="waypoint"></param>
 /// <param name="speed"></param>
 public static void DriveTo(this Vehicle vehicle, Ped ped, Vector3 waypoint, float speed, DrivingStyle drivingStyle)
 {
     if (!vehicle.IsSafeExist() || !ped.IsSafeExist())
     {
         return;
     }
     Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, ped, vehicle, waypoint.X, waypoint.Y, waypoint.Z, speed, 1, vehicle.Model.Hash, 1, (int)drivingStyle, -1);
 }
Exemple #34
0
        private async Task UpdateSourceAsync(string property = "")
        {
            ListTrip.Clear();

            #region DesignMode

            if (DesignMode.DesignModeEnabled)
            {
                ListTrip.Add(new TripAdvisorViewModel(new TripAdvisorModel
                {
                    DID             = "1",
                    CurrentDistance = 150,
                    TripTime        = 256,
                    MedianSpeed     = 65,
                }));
                ListTrip.Add(new TripAdvisorViewModel(new TripAdvisorModel
                {
                    DID             = "1",
                    CurrentDistance = 180,
                    TripTime        = 298,
                    MedianSpeed     = 78,
                }));
                ListTrip.Add(new TripAdvisorViewModel(new TripAdvisorModel
                {
                    DID             = "1",
                    CurrentDistance = 150,
                    TripTime        = 256,
                    MedianSpeed     = 65,
                }));
                ListTrip.Add(new TripAdvisorViewModel(new TripAdvisorModel
                {
                    DID             = "1",
                    CurrentDistance = 180,
                    TripTime        = 298,
                    MedianSpeed     = 78,
                }));
                _styleDriver = new DrivingStyle
                {
                    DID = "1",
                    CurrentDrivingStyle = 67,
                    CurrentEcoStyle     = 89,
                    TodayDrivingScore   = 58,
                    TodayEcoScore       = 68,
                    TotalDrivingScore   = 68,
                    TotalEcoScore       = 98
                };
            }

            #endregion

            ReciveMessageModel res = null;
            var request            = string.Empty;
            switch (property)
            {
            case "StartDate":
                ListStartPoint.Clear();
                request =
                    JsonConvert.SerializeObject(new PointsRequestModel
                {
                    Date  = new DateDataModel(StartDate),
                    DevID = CarId
                });
                res = await TcpConnection.Send("BN" + request);

                break;

            case "EndDate":
                ListEndPoint.Clear();
                request =
                    JsonConvert.SerializeObject(new PointsRequestModel
                {
                    Date  = new DateDataModel(EndDate),
                    DevID = CarId
                });
                res = await TcpConnection.Send("BN" + request);

                break;

            default:
                request =
                    JsonConvert.SerializeObject(new TripRequestModel
                {
                    Start = new DateTimeDataModel(_starTime),
                    Stop  = new DateTimeDataModel(_endTime),
                    devID = CarId
                });
                res = await TcpConnection.Send("BM" + request);

                break;
            }
            if (res == null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(res.Msg))
            {
                await Split(res.Fx, res.Msg, property.Equals("EndDate"));
            }
            OnSourceChenged(property);
        }
Exemple #35
0
 // This is the "factory methoc"
 protected internal abstract IVehicle SelectVehicle(
                                DrivingStyle style);