void Awake()
    {
        car = GetComponent<Car>();
        inv = GetComponentInChildren<CarInventory>();

        //neuen CameraController aufsetzen
        if(this.networkView.isMine || Network.connections.Length == 0){
            GameObject camObj;
            camObj = (GameObject)GameObject.Instantiate(cameraCtrlPrefab, car.transform.position, car.transform.rotation);

            cameraCtrl = camObj.GetComponent<CameraController>();

            cameraCtrl.targetCar = car;
            //erstes Element ist Motorhaubenkamera
            cameraCtrl.hoodCamera = additionalCameraPositions[0];
            //zweites Element ist Kofferraumkamera
            cameraCtrl.hoodCameraLookBack = additionalCameraPositions[1];

            GameObject hudObj;
            hudObj = (GameObject) GameObject.Instantiate(hudPrefab);

            hud = hudObj.GetComponent<HUD>();
            hud.cameraObject = camObj;
            setupHUD();
        }
    }
Beispiel #2
0
        public ActionResult Update(CarInventory carinventory)
        {
            var carinventoryInDb = _dbContext.CarInventories.SingleOrDefault(v => v.Id == carinventory.Id);

            if (carinventoryInDb == null)
            {
                return(HttpNotFound());
            }

            carinventoryInDb.AgencyId         = carinventory.AgencyId;
            carinventoryInDb.CarId            = carinventory.CarId;
            carinventoryInDb.AirConditionner  = carinventory.AirConditionner;
            carinventoryInDb.DailyRate        = carinventory.DailyRate;
            carinventoryInDb.DVDplayer        = carinventory.DVDplayer;
            carinventoryInDb.IsReserved       = carinventory.IsReserved;
            carinventoryInDb.MP3player        = carinventory.MP3player;
            carinventoryInDb.NavigationSystem = carinventory.NavigationSystem;
            carinventoryInDb.Odometer         = carinventory.Odometer;
            carinventoryInDb.SerialNumber     = carinventory.SerialNumber;
            carinventoryInDb.year             = carinventory.year;
            carinventoryInDb.IsActive         = carinventory.IsActive;
            carinventoryInDb.CreatedBy        = carinventory.CreatedBy != string.Empty ? carinventory.CreatedBy : User.Identity.Name;
            carinventoryInDb.CreatedOn        = carinventory.CreatedOn != DateTime.MinValue ? carinventory.CreatedOn : DateTime.Now;
            carinventoryInDb.ModifiedBy       = User.Identity.Name;
            carinventoryInDb.ModifiedOn       = DateTime.Now;

            _dbContext.SaveChanges();

            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult Add(CarInventory carinventory)
        {
            carinventory.CreatedBy = User.Identity.Name;
            carinventory.CreatedOn = DateTime.Now;
            carinventory.IsActive  = true;

            _dbContext.CarInventories.Add(carinventory);
            _dbContext.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            CarInventory cInv = other.GetComponent <CarInventory>();

            if (cInv)
            {
                cInv.AddCoin(value);
                Destroy(gameObject);
            }
        }
Beispiel #5
0
        public CarInventory ChosenCar(int id)
        {
            CarInventory oneCar = DB.CarInventories.FirstOrDefault(c => c.ID == id);

            if (oneCar == null)
            {
                return(null);
            }
            else
            {
                return(oneCar);
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("\nWelcome To COMP 212 INVENTORY EVENT PROGRAM OF NAZIF SAHIM");
            Console.WriteLine("**********************************************************");

            CarInventory carInventory = CarSold;

            carInventory.Invoke();
            LowStock obj = new LowStock();

            obj.carEvent += SendAlert.DisplayAlert;
            obj.Notify();
        }
        public List <CarInventory> GetDiscountedCars()
        {
            List <CarInventory> allCars = GetAllCars();
            List <Deal>         deals   = new List <Deal>();

            using (SqlConnection connection = DatabaseHelper.Instance.GetConnection())
            {
                connection.Open();
                string     sql     = "select * from Deals";
                SqlCommand command = new SqlCommand(sql, connection);

                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    int   id              = (int)reader["id"];
                    int   carId           = (int)reader["carId"];
                    float discountedPrice = float.Parse(reader["discountedPrice"].ToString());

                    CarInventory car = new CarInventory();
                    car.Id = carId;
                    Deal deal = new Deal(id, car, discountedPrice);

                    deals.Add(deal);
                }
                reader.Close();
            }

            List <CarInventory> discountedCars = new List <CarInventory>();

            foreach (Deal d in deals)
            {
                foreach (CarInventory c in allCars)
                {
                    if (d.Car.Id == c.Id)
                    {
                        CarInventory car = c;
                        car.FinalPrice = d.DiscountedPrice;
                        discountedCars.Add(car);
                    }
                }
            }
            return(discountedCars);
        }
        public List <CarInventory> GetAllCars()
        {
            List <CarInventory> cars = new List <CarInventory>();

            using (SqlConnection connection = DatabaseHelper.Instance.GetConnection())
            {
                connection.Open();
                string     sql     = "select * from CarsInventory";
                SqlCommand command = new SqlCommand(sql, connection);

                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    int      id           = (int)reader["id"];
                    int      modelId      = (int)reader["modelId"];
                    int      colorId      = (int)reader["colorId"];
                    DateTime buildDate    = (DateTime)reader["buildDate"];
                    int      mileage      = (int)reader["mileage"];
                    float    initialPrice = float.Parse(reader["initialPrice"].ToString());
                    float    finalPrice   = float.Parse(reader["finalPrice"].ToString());
                    string   optionsLevel = (string)reader["optionsLevel"];
                    int      engineId     = (int)reader["engineId"];

                    IModelDAO modelDAO = new ModelDAO();
                    Model     model    = modelDAO.GetModel(modelId);

                    IColorDAO colorDAO = new ColorDAO();
                    Color     color    = colorDAO.GetColor(colorId);

                    IEngineDAO engineDAO = new EngineDAO();
                    Engine     engine    = engineDAO.GetEngine(engineId);

                    CarInventory car = new CarInventory(id, model, color, engine, buildDate, mileage, initialPrice);

                    EOptionsLevel eLevel = EOptionsLevel.Basic;

                    switch (optionsLevel)
                    {
                    case "basic":
                        eLevel = EOptionsLevel.Luxury;
                        break;

                    case "Entry":
                        eLevel = EOptionsLevel.Entry;
                        break;

                    case "Premium":
                        eLevel = EOptionsLevel.Premium;
                        break;

                    case "Luxury":
                        eLevel = EOptionsLevel.Luxury;
                        break;
                    }

                    IOptionDAO    optionDAO = new OptionDAO();
                    List <Option> options   = optionDAO.GetLevelOptions(eLevel);

                    car.OptionsLevel = eLevel;
                    car.Options      = options;
                    car.FinalPrice   = finalPrice;

                    cars.Add(car);
                }
                reader.Close();
            }
            return(cars);
        }
Beispiel #9
0
    // Use this for initialization
    void Start()
    {
        camControl = cameraObject.GetComponent<CameraController>();
        car = camControl.targetCar;
        inventory = car.GetComponent<CarInventory>();

        weapon.gameObject.layer = layer;
        ammo.gameObject.layer = layer;
        rank.gameObject.layer = layer;
        modeInfo.gameObject.layer = layer;
        health.gameObject.layer = layer;
        healthFrame.gameObject.layer = layer;
        this.gameObject.layer = layer;

        healthMaxBorderValue = health.transform.localScale.x;
        maxHealth = car.getHealth();

        speedoSizeY = Screen.height/4f;
        speedoSizeX = Screen.height/4f;
        initialScreenWidth = Screen.width;
        speedoArrowSizeX = speedoSizeX;
        speedoArrowSizeY = speedoSizeY;
        offset = 15.0f;
    }
Beispiel #10
0
 public CarBuilder()
 {
     car = new CarInventory();
 }
Beispiel #11
0
 public void TestDrive(CarInventory car, int distance)
 {
     carInventoryDAO.TestDrive(car.Id, distance);
 }