Esempio n. 1
1
        static void Main(string[] args)
        {
            Car car = new Car();
            car.Price = 18000;
            car.Brand = "Skoda";

            Automobile automobile = new Automobile();
            automobile.Price = 38000;
            automobile.FullConsumation = 15;

            SUV jeep = new SUV();
            jeep.Price = 50000;
            jeep.IsHighly = true;

            string[] carBrand = new string[10];

            for (int i = 0; i < carBrand.Length; i++)
            {
                if ( i >= 0 && i <= 4)
                {
                    Console.WriteLine("Please enter the car brand ");
                    carBrand[i] = Console.ReadLine();

                }

                else if (i >= 5 && i <= 10)
                {
                    Console.WriteLine("Plaese enter the SUV brand ");
                    carBrand[i] = Console.ReadLine();
                }

            }
            int[] carPrice = new int [10];

            for (int i = 0; i <carPrice.Length; i++)
            {
                if (i >= 0 && i <= 4)
                {
                    Console.WriteLine("Please enter the price of car ");
                   carPrice[i] =int.Parse( Console.ReadLine());

                }
                else if (i >= 5 && i <= 10)
                {
                    Console.WriteLine("Please enter the price of SUV ");
                    carPrice[i] = int.Parse(Console.ReadLine());
                }
            }
            bool[] highly = new bool[10];

            for (int i = 0; i < highly.Length; i++)
            {
                if (i >= 0 && i <= 4)
                {
                    highly[i] = false;
                }
                else
                {
                    highly[i] = true;
                }
            }
            Car[] carses = new Car[5];
            SUV test = new SUV();

            for (int i = 0; i <10; i++)
            {
                Car Information = new Car();
                Information.Price = carPrice[i];
                jeep.IsHighly = highly[i];
                Console.Write("BRAND " + carBrand[i]);
                Console.Write(" PRICE " + Information.Price);
                Console.Write(" IS HIGHLY = " + jeep.IsHighly);
                Console.WriteLine();

            }
        }
 public void ResetCar(Car car, Vector3 pos)
 {
     Quaternion rot = Quaternion.identity;
     car.CarObject.Acceleration = 0f;
     car.CarObject.NetworkView.RPC("UpdatePosition", RPCMode.All, pos, 0f, car.CarNumber - 1);
     car.CarObject.NetworkView.RPC("UpdateRotation", RPCMode.All, rot, car.CarNumber - 1);
 }
        public void SetUp()
        {
            Player = new Player();

            DriverRole = new Driver();
            Car = new Car();
            PlayerPar = new Player(Car, DriverRole);
        }
Esempio n. 4
0
 private void radioButton2_CheckedChanged(object sender, EventArgs e)
 {
     currentCar = businessCar;
     pictureBox1.ImageLocation = "Pictures/" + businessCar.ImageFilename + "";
     label5.Text = businessCar.Brand;
     label7.Text = businessCar.LatestMileage.ToString();
     label5.Visible = true;
     label7.Visible = true;
 }
Esempio n. 5
0
        public static void AddCars(Queue<Car>[] Cars, int countCar, int countCashes)
        {
            Random rnd = new Random();
            int carNumber = 0;
            double tNow = 0;
            int sleep = 1000;

            while (true)
            {
                for (int i = 0; i < countCar; i++)
                {
                    int cashnum = rnd.Next(countCashes);
                    Car car = new Car(carNumber++, tNow / 1000);
                    Cars[cashnum].Enqueue(car);
                    tNow += sleep;
                    Console.WriteLine("Машина {0} в кассу {1}", car.num.ToString(), cashnum);
                }
                System.Threading.Thread.Sleep(sleep);
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            double speed = 100.0;
            int playFieldWidth = 5;
            int livesCount = 5;

            //Removing the scrollbar(buffer)
            Console.BufferHeight = Console.WindowHeight = 30;
            Console.BufferWidth = Console.WindowWidth = 30;
            //Positioning the user car(color, x, y, char)
            Car userCar = new Car();
            userCar.x = 2;
            userCar.y = Console.WindowHeight - 1;
            userCar.c = '$';
            userCar.color = ConsoleColor.Blue;

            Random randomGenerator = new Random();

            //Creating other enemy cars
            List<Car> enemyCars = new List<Car>();
            bool colide = false;
            while (true)
            {
                speed++;

                if (speed > 250)
                {
                    speed = 250;
                }
                //Move cars
                randomGenerator.Next(1, 5);
                {
                    Car newCar = new Car();
                    newCar.color = ConsoleColor.Green;
                    newCar.x = randomGenerator.Next(0, playFieldWidth);
                    newCar.y = 0;
                    newCar.c = '^';
                    enemyCars.Add(newCar);
                }

                //Move our car(key pressed)

                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo pressedKey = Console.ReadKey(true);
                    while (Console.KeyAvailable)
                    {
                        Console.ReadKey(true);
                    }
                    if (pressedKey.Key == ConsoleKey.LeftArrow)
                    {
                        if (userCar.x - 1 >= 0)
                        {
                            userCar.x--;
                        }

                    }
                    if (pressedKey.Key == ConsoleKey.RightArrow)
                    {
                        if (userCar.x + 1 <= 5)
                        {
                            userCar.x++;
                        }
                    }
                }
                List<Car> newList = new List<Car>();
                for (int i = 0; i < enemyCars.Count; i++)
                {
                    Car oldCar = enemyCars[i];
                    Car newCar = new Car();
                    newCar.x = oldCar.x;
                    newCar.y = oldCar.y + 1;
                    newCar.c = oldCar.c;
                    newCar.color = oldCar.color;
                    //colision
                    if (newCar.y == userCar.y && newCar.x == userCar.x)
                    {

                        livesCount--;
                        colide = true;
                        speed += 10;

                        if (livesCount<=0)
                        {
                            stringPrintOnPosition(8, 7, "GAME OVER!!!", ConsoleColor.Red);
                            stringPrintOnPosition(8, 12, "Press any key to continue!!!!", ConsoleColor.Red);
                            Console.ReadLine();
                            return;
                        }
                    }
                    if (newCar.y < Console.WindowHeight)
                    {
                        newList.Add(newCar);
                    }

                }
               enemyCars = newList;

                //Clear the console
                Console.Clear();
                //Redraw playfield

                foreach (Car car in enemyCars)
                {
                    PrintOnPosition(car.x, car.y, car.c, car.color);
                }
                if (colide==true)
                {
                    enemyCars.Clear();
                    PrintOnPosition(userCar.x, userCar.y, 'X', ConsoleColor.Yellow);
                }
                else
                {
                    PrintOnPosition(userCar.x, userCar.y, userCar.c, userCar.color);
                }
                colide = false;
                //Drow Info

                stringPrintOnPosition(8,5,"Lives : " + livesCount,ConsoleColor.White);
                stringPrintOnPosition(8, 6, "Speed : " + speed, ConsoleColor.White);
                //Console.Beep();
                //Slow donw the speed
                Thread.Sleep((int)(300 - speed));
            }
        }
Esempio n. 7
0
 static void Main(string[] args)
 {
     Car car = new Car();
 }