コード例 #1
0
ファイル: SearchPage.cs プロジェクト: neefez/Intermediate-SE
        /// <summary>
        /// Brings up the car info page for the <seealso cref="Vehicle"/>
        /// the <seealso cref="User"/> clicks on.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listView1_ItemSelectionChanged(object sender,
                                                    ListViewItemSelectionChangedEventArgs e)
        {
            Vehicle v1 = (Vehicle)e.Item.Tag;

            if (v1 != null)
            {
                RentalControl.SelectedVehicle = v1;
                if (isModifySearchPage)
                {
                    List <string> features = VehicleControl.DisplayCarInfo(
                        RentalControl.SelectedVehicle.VehicleID.ToString());
                    modifyPanel.Visible = true;
                    searchPanel.Visible = false;
                    FillModifyInfo(features);
                }
                else
                {
                    List <string> features = VehicleControl.DisplayCarInfo(
                        RentalControl.SelectedVehicle.VehicleID.ToString());
                    carInfoPanel.Visible = true;
                    searchPanel.Visible  = false;
                    FillInfo(features);
                }
            }
        }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     // Get the rigidbody, box collider & vehicle control components for the attached ship object
     ship         = GetComponent <Rigidbody>();
     shipCollider = GetComponent <BoxCollider>();
     vc           = GetComponent <VehicleControl> ();
 }
コード例 #3
0
        public void DeterminePriceTest()
        {
            Vehicle v     = new Vehicle("t", "c", 1, "m", "m2", false, false, 50, "m");
            int     price = VehicleControl.DeterminePrice(v);

            Assert.AreEqual(price, v.Rate * 100);
        }
コード例 #4
0
        public async Task <IActionResult> Checkout(int id, [Bind("Id,Placa,HoraEntrada,HoraSaida,Duracao,QtdHorasCobradas,ValorHora")] VehicleControl vehicleControl)
        {
            if (id != vehicleControl.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleControl);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleControlExists(vehicleControl.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicleControl));
        }
コード例 #5
0
ファイル: AdminPage.cs プロジェクト: neefez/Intermediate-SE
        /// <summary>
        /// AddVehicle button will take the information entered on the form and
        /// create a vehicle representation in the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddVehicle_Click(object sender, EventArgs e)
        {
            if (carColorCB.SelectedItem == null || carTypeCB.SelectedItem == null ||
                carMakeCB.SelectedItem == null || carModelCB.Text == "" ||
                carLocationCB.SelectedItem == null)
            {
                SetAndDisplayResponseMessage(FORM_NOT_FILLED_MESSAGE);
            }
            else
            {
                string  type        = carTypeCB.SelectedItem.ToString();
                string  color       = carColorCB.SelectedItem.ToString();
                int     year        = (Int32)carYearCB.Value;
                string  model       = carModelCB.Text.ToString();
                string  carMake     = carMakeCB.SelectedItem.ToString();
                string  carlocation = carLocationCB.SelectedItem.ToString();
                bool    rightHand   = rightHandCheck.Checked;
                bool    manual      = manualCheck.Checked;
                int     rate        = (Int32)rateBox.Value;
                Vehicle v           = new Vehicle(type, color, year, model, carMake,
                                                  rightHand, manual, rate, carlocation);
                VehicleControl.AddVehicle(v);

                if (VehicleWasAdded(v.PrimaryKey))
                {
                    SetAndDisplayResponseMessage(VEHICLE_ADDED_MESSAGE);
                }
                else
                {
                    SetAndDisplayResponseMessage(VEHICLE_NOT_ADDED_MESSAGE);
                }
                ResetForm();
            }
        }
コード例 #6
0
        private void ApplyTo2(Vehicle vehicle, bool noOccupants)
        {
            vehicle.ThrottlePower = Throttle;
            vehicle.BrakePower    = Brake;
            VehicleControl.SetHandbrake(vehicle, Handbrake);
            vehicle.SteeringAngle  = SteeringAngle;
            vehicle.AreLightsOn    = Lights;
            vehicle.AreHighBeamsOn = Headlights;

            vehicle.HealthFloat         = Health;
            vehicle.EngineHealth        = EngineHealth;
            vehicle.Mods.PrimaryColor   = PrimaryColor;
            vehicle.Mods.SecondaryColor = SecondaryColor;
            vehicle.Mods.Livery         = Livery;

            vehicle.IsEngineRunning = EngineRunning;

            vehicle.CurrentRPM  = RPM;
            vehicle.CurrentGear = Gear;

            if (noOccupants)
            {
                return;
            }

            foreach (PedReplica pedReplica in Occupants)
            {
                pedReplica.Spawn(vehicle);
            }
        }
コード例 #7
0
ファイル: AdminPage.cs プロジェクト: neefez/Intermediate-SE
        /// <summary>
        /// VehiclewasAdded method will confirm if the vehicle could be added
        /// to the database.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private bool VehicleWasAdded(int id)
        {
            Vehicle v1        = VehicleControl.FindVehicle(id.ToString());
            string  vehicleID = v1.PrimaryKey.ToString();

            return(id.ToString() == vehicleID);
        }
コード例 #8
0
        public Spike3Form()
        {
            InitializeComponent();
            Vehicle v1 = VehicleControl.FindVehicle("0");

            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
        }
コード例 #9
0
        public void ApplyTo(Vehicle vehicle, SpawnFlags spawnFlags = SpawnFlags.Default)
        {
            ApplyTo2(vehicle, spawnFlags.HasFlag(SpawnFlags.NoOccupants));

            if (!spawnFlags.HasFlag(SpawnFlags.NoPosition))
            {
                vehicle.PositionNoOffset = Position;
                vehicle.Heading          = Heading;
                vehicle.Rotation         = Rotation;
            }

            if (spawnFlags.HasFlag(SpawnFlags.SetRotation))
            {
                vehicle.Rotation = Rotation;
            }

            if (!spawnFlags.HasFlag(SpawnFlags.NoVelocity))
            {
                vehicle.Velocity = Velocity;
                vehicle.Speed    = Speed;
            }

            if (spawnFlags.HasFlag(SpawnFlags.NoWheels))
            {
                return;
            }

            for (int i = 0; i < WheelsRotations.Length; i++)
            {
                VehicleControl.SetWheelRotation(vehicle, i, FusionUtils.Wrap(WheelsRotations[i], -(float)Math.PI, (float)Math.PI));
                VehicleControl.SetWheelCompression(vehicle, i, WheelsCompressions[i]);
            }
        }
コード例 #10
0
 void Start()
 {
     restTimeer     = carRestTime;
     currentLap     = 0;
     vehicleControl = transform.GetComponent <VehicleControl>();
     currentNode    = nextNode;
 }
コード例 #11
0
        public void AddPurchaseTest()
        {
            Vehicle v = new Vehicle("type", "color", 100, "model", "make", true, true, 10, "here");

            DBController.Save(v, DBObject.SaveTypes.Insert);
            DateTime startDate1 = new DateTime(2018, 1, 1);
            DateTime endDate1   = new DateTime(2018, 1, 2);
            Vehicle  v2         = VehicleControl.FilterCar("type", "color", "make", 99, 101, true, true, "here", startDate1, endDate1).FirstOrDefault();

            Assert.IsNotNull(v2);
            Customer c1 = new Customer("John", "Doe", "username", "password");

            DBController.Save(c1, DBObject.SaveTypes.Insert);
            DateTime startDate = new DateTime(2018, 1, 1);
            DateTime endDate   = new DateTime(2018, 1, 2);
            Purchase p1        = new Purchase(startDate, "here", v2, c1);

            PurchaseControl.AddPurchase(p1);
            Vehicle v3 = VehicleControl.FilterCar("type", "color", "make", 99, 101, true, true, "here", startDate, endDate).FirstOrDefault();

            Assert.IsNull(v3);
            Vehicle v4 = VehicleControl.GetAllVehicles().Where(vehicle => vehicle.VehicleID == p1.VehicleID).FirstOrDefault();

            Assert.IsTrue(v4.IsRented);
        }
コード例 #12
0
        public void DisplayCarInfoTest()
        {
            string        id       = "1";
            Vehicle       v2       = new Vehicle("DEFAULT", "DEFAULT", 0, "DEFAULT", "DEFAULT", false, false, 0, "Madison");
            List <string> features = VehicleControl.DisplayCarInfo(id);

            Assert.AreEqual(v2.PrimaryKey, v2.PrimaryKey);
        }
コード例 #13
0
ファイル: VehicleCamera.cs プロジェクト: Dzyfhuba/BR-Game
    void Start()
    {
        carScript = (VehicleControl)target.GetComponent <VehicleControl>();

        myRigidbody = target.GetComponent <Rigidbody>();

        cameraSwitchView = carScript.carSetting.cameraSwitchView;
    }
コード例 #14
0
    // Use this for initialization
    void Start()
    {
        // Get the rigidbody, box collider & vehicle control components for the attached ship object
        vc = GetComponentInParent <VehicleControl> ();
        gm = GameObject.Find("GameManager").GetComponent <GameManager> ();

        this.transform.parent = null;
    }
コード例 #15
0
        public void AddVehicleTest()
        {
            Vehicle v1 = new Vehicle("1", "Blue", 2018, "2", "3", false, false, 10, "Madison");

            VehicleControl.AddVehicle(v1);
            Vehicle v2 = DBController.GetByPrimaryKey <Vehicle>(v1.PrimaryKey);

            Assert.IsNotNull(v2);
        }
コード例 #16
0
        public void PreliminaryFilterTest()
        {
            List <Vehicle> lv = VehicleControl.PreliminaryFilter();

            foreach (Vehicle item in lv)
            {
                Assert.IsFalse(item.IsRented);
            }
        }
コード例 #17
0
ファイル: SearchPage.cs プロジェクト: neefez/Intermediate-SE
        /// <summary>
        /// Deletes the <seealso cref="Vehicle"/> that the
        /// <seealso cref="Admin"/> has selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteButton_Click(object sender, EventArgs e)
        {
            Vehicle v = RentalControl.SelectedVehicle;

            VehicleControl.RemoveVehicle(v);
            UpdateList();
            carInfoPanel.Visible = false;
            searchPanel.Visible  = true;
        }
コード例 #18
0
        private void PredictAccleration()
        {
            _possibleFastAccel = true; // get in default state

            _carAngle = Vehicle.Rotation.X;

            // Check if any wheel is not on allowed surface
            foreach (var wheelPos in _wheelPos)
            {
                var surface = World.Raycast(wheelPos, wheelPos + new Vector3(0, 0, -10),
                                            IntersectFlags.Everything, Vehicle);

                if (!_allowedSurfaces.Contains(surface.MaterialHash))
                {
                    _possibleFastAccel = false;
                }
            }

            // Check if car angle is too high or not on all wheels
            if (_possibleFastAccel)
            {
                if (_carAngle > 7 || !Vehicle.IsOnAllWheels || Utils.IsAnyTireBurst(Vehicle))
                {
                    _possibleFastAccel = false;
                }
            }

            // Check for player bursting car tires
            if (VehicleControl.GetWheelRotationSpeeds(Vehicle)[0] < 1f)
            {
                // Check if car is on same place
                if (Speed < 1)
                {
                    _wheelPosPrev = _wheelPos;
                    _isPosChanged = false;
                }

                if (_wheelPosPrev != null)
                {
                    foreach (var pos in _wheelPos)
                    {
                        if (pos.Round(1) != _wheelPosPrev[
                                _wheelPos.IndexOf(pos)].Round(1))
                        {
                            _isPosChanged = true;
                            break;
                        }
                    }
                }

                if (_isPosChanged && _possibleFastAccel)
                {
                    _possibleFastAccel = false;
                }
            }
        }
コード例 #19
0
        public void RemoveVehicleTest()
        {
            Vehicle v = new Vehicle();

            DBController.Save(v, DBObject.SaveTypes.Insert);
            VehicleControl.RemoveVehicle(v);
            Vehicle v2 = DBController.GetByPrimaryKey <Vehicle>(v.PrimaryKey);

            Assert.IsNull(v2);
        }
コード例 #20
0
    void OnEnable()
    {
        SkillSystemRoot targetComponent = target as SkillSystemRoot;
        VehicleControl  vehicleControl  = targetComponent.gameObject.GetComponent <VehicleControl>();

        if (vehicleControl == null)
        {
            Debug.LogError("해당 스크립트가 Attach 되기 위해서는 VehicleControl 스크립트가 존재하여야 합니다.");
            DestroyImmediate(targetComponent);
        }
    }
コード例 #21
0
        public void FixTest()
        {
            DateTime     issueDate = new DateTime(2018, 1, 1);
            string       Issue     = "The car broke down and won't start!";
            Vehicle      v1        = VehicleControl.GetAllVehicles().FirstOrDefault();
            VehicleIssue vI1       = new VehicleIssue(issueDate, Issue, v1);

            Assert.IsFalse(vI1.IsFixed);
            VehicleIssueControl.Fix(vI1);
            Assert.IsTrue(vI1.IsFixed);
        }
コード例 #22
0
        public void FindVehicleTest()
        {
            string  id = "1";
            Vehicle v  = VehicleControl.FindVehicle(id);
            Vehicle v2 = new Vehicle("test", "test", 1, "test", "test", false, false, 1, "Madison");

            Assert.AreEqual(v2.Make, v.Make);
            Assert.AreEqual(v.Model, v2.Model);
            Assert.AreEqual(v.VehicleYear, v2.VehicleYear);
            Assert.AreEqual(v.Color, v2.Color);
        }
コード例 #23
0
    // ======================================================= Unity Methods ======================================================= //
    // Use this for initialization
    void Start()
    {
        if (vehicleRigidbody == null)
        {
            vehicleRigidbody = gameObject.GetComponent <Rigidbody>();
        }

        if (vehicleControl == null)
        {
            vehicleControl = gameObject.GetComponent <VehicleControl>();
        }
    }
コード例 #24
0
        public Icon()
        {
            int a       = 10;
            var vehBox  = new VehicleControl();
            var infoGet = new FrontPage();

            vehBox.pnlVCMenu.BackColor = Color.DarkRed;
            vehBox.lblTESST.Text       = infoGet.txtBoxTag.Text;
            vehBox.Top  = 80;
            vehBox.Left = a;
            a           = a + 90;
        }
コード例 #25
0
        public void PurchaseControlDataTest()
        {
            string   location   = "here";
            DateTime dateEx     = new DateTime(2001, 1, 1);
            Vehicle  purchasedV = VehicleControl.GetAllVehicles().FirstOrDefault();

            PurchaseControl.PickUpLocation  = "here";
            PurchaseControl.StartDate       = dateEx;
            PurchaseControl.SelectedVehicle = purchasedV;
            Assert.AreEqual(PurchaseControl.PickUpLocation, location);
            Assert.AreEqual(PurchaseControl.SelectedVehicle, purchasedV);
            Assert.AreEqual(PurchaseControl.StartDate, dateEx);
        }
コード例 #26
0
        public async Task <IActionResult> Create([Bind("Id,Placa,HoraEntrada,HoraSaida,Duracao,QtdHorasCobradas,ValorHora")] VehicleControl vehicleControl)
        {
            if (ModelState.IsValid)
            {
                vehicleControl.HoraSaida = vehicleControl.HoraEntrada;

                _context.Add(vehicleControl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicleControl));
        }
コード例 #27
0
        public void SetVehicleListTest()
        {
            DateTime initialDateControl = new DateTime(2015, 8, 16, 0, 0, 0);
            DateTime finalDateControl   = new DateTime(2015, 11, 15, 23, 59, 59);
            double   hourPrice          = 5;

            ValidityControl.AddDateControl(hourPrice, initialDateControl, finalDateControl);

            string          board   = "ABC 8801";
            DateTime        dateIn  = new DateTime(2015, 9, 25, 15, 30, 0);
            VehicleEntrance vehicle = new VehicleEntrance(board, dateIn);

            VehicleControl.AddVehicle(vehicle);
            Assert.AreEqual(vehicle, VehicleControl.GetVehicleInside(vehicle.Board));
        }
コード例 #28
0
    public void Spawn()
    {
        FollowerCam[] followerCams = GameObject.FindObjectsOfType <FollowerCam>();

        for (int i = 0; i < 2; i++)
        {
            VehicleControl spawnedVehicle = CreateVehicle(i).GetComponent <VehicleControl>();
            spawnedVehicle.vehicleID = i;

            // Link to camera
            followerCams[i].followingTarget = spawnedVehicle.transform;

            spawnedVehicles[i] = spawnedVehicle.gameObject;
        }
    }
コード例 #29
0
    void Start()
    {
        GameObject InstantiatedCar = Instantiate(CarsPrefabs[PlayerPrefs.GetInt("CurrentVehicle")], startPoint.position, startPoint.rotation) as GameObject;

        InstantiatedCar.GetComponent <AIVehicle>().nextNode = firstAINode;

        CurrentVehicle = InstantiatedCar.GetComponent <VehicleControl>();

        VehicleCamera.manage.target           = InstantiatedCar.transform;
        VehicleCamera.manage.cameraSwitchView = CurrentVehicle.cameraView.cameraSwitchView;

        VehicleCamera.manage.distance = CurrentVehicle.cameraView.distance;
        VehicleCamera.manage.height   = CurrentVehicle.cameraView.height;
        VehicleCamera.manage.angle    = CurrentVehicle.cameraView.angle;
    }
コード例 #30
0
    private void Awake()
    {
        // Set up all connections between the scripts
        Rb                     = GetComponent <Rigidbody>();
        VehicleControl         = GetComponent <VehicleControl>();
        VehicleControl.Vehicle = this;
        InitializeParts();

        #region Debug
        if (Debug.DebugEnabled)
        {
            Rb.velocity = Debug._testFlightV;
        }
        #endregion
    }