static void Main(string[] args) { string[] menuiItems = new string[] { "quit", "create new vehicle", "show all vehicles in list", "show max speed vehicle", "show the newest vehicle", "show the oldest vehicle", "clear console" }; int indexCommand; CCar Car1 = new CCar(new GPS(1, 1), 10, 2018); CPlane Plane1 = new CPlane(new GPS(2, 2), 100, 2015, "100 m", 200); CPlane Plane2 = new CPlane(new GPS(2, 2), 200, 2015, "200 m", 300); CShip Ship1 = new CShip(new GPS(3, 3), 250, 2014, 50, "PortName"); CShip Ship2 = new CShip(new GPS(4, 4), 150, 2013, 20, "PortName2"); do { indexCommand = UserConsoleInteractor.GetCommandFromOptionMenu(menuiItems); UserConsoleInteractor.ChooseOptionMenu(indexCommand); } while (indexCommand != 0); Console.ReadLine(); }
public void Road(CCar car) { PrepareState(); m_carController.SetActive(true); m_vezdehod.Build(car); m_road.SetActive(true); m_roadCamera.SetActive(true); }
static void Main(string[] args) { CVehicle[] massTransport = new CVehicle[12]; massTransport[0] = new CCar("Car #1", 1000, 100, 2015, 0, 0, "Red"); massTransport[1] = new CPlane("Plane#1", 500000, 1000, 2010, 0, 0, 5000, 230); massTransport[2] = new CShip("Ship #1", 400000, 60, 2016, 0, 0, 500, "Kiyv"); massTransport[3] = new CCar("Car #2", 1200, 120, 2017, 0, 0, "Green"); massTransport[4] = new CPlane("Plane#2", 520000, 900, 2014, 0, 0, 7000, 120); massTransport[5] = new CShip("Ship #1", 420000, 40, 2018, 0, 0, 700, "Kiyv 1"); massTransport[6] = new CCar("Car #4", 1300, 120, 2016, 0, 0, "Yellow"); massTransport[7] = new CPlane("Plane#3", 530000, 1100, 2012, 0, 0, 8000, 280); massTransport[8] = new CShip("Ship #1", 430000, 30, 2014, 0, 0, 400, "Dnipro"); massTransport[9] = new CCar("Car #3", 1400, 130, 2015, 0, 0, "Blue"); massTransport[10] = new CPlane("Plane#4", 550000, 1200, 2011, 0, 0, 4000, 100); massTransport[11] = new CShip("Ship #1", 460000, 70, 2017, 0, 0, 520, "Chernigov"); Console.WriteLine("1. Найти транспортное стредство от 2011 до 2015 года выпуска"); Console.WriteLine("2. Найти транспортное стредство со скоростью от 70 до 900 км/час "); Console.WriteLine("3. Найти транспортное стредство с посадочными местами от 150 до 500"); Console.WriteLine("4. Найти транспортное стредство красного цвета"); Console.WriteLine("Введите пункт меню"); int MenuItem; int.TryParse(Console.ReadLine(), out MenuItem); Console.WriteLine("Результат поиска"); switch (MenuItem) { case 1: MySearch.VehicleYear(massTransport, 2015, 2011); break; case 2: MySearch.VehicleSpeed(massTransport, 900, 70); break; case 3: MySearch.VehiclePassengerCapacity(massTransport, 500, 150); break; case 4: MySearch.VehicleColor(massTransport, "Red"); break; default: break; } Console.WriteLine("Полный список"); foreach (var item in massTransport) { Console.WriteLine(item.ToString()); } Console.ReadLine(); }
private void OnClick() { var car = new CCar(); foreach (GridItem item in GridModel.GetInstalledBlocks()) { car.Insert(item.detail, item.x, item.y); } m_game.Road(car); }
private static void GetWilsCount(List <CVehicle> vehicles) { foreach (var item in vehicles) { CCar car = item as CCar; if (car != null) { Console.WriteLine(car.GetWhilsCount()); Console.WriteLine("\n"); } } }
public void updateEnemy(CCar car) //+ { if (car.Equals(enemySecond)) { int[] numbers = new int[] { 517, 517, 517, 427, 517, 517, 517, 517, 517, 427 }; int index = rand.Next(0, numbers.Length); int number = numbers[index]; enemySecond.Update(enemySecond.Left -= 20, number); } else if (car.Equals(enemy)) { int[] numbers = new int[] { 427, 517, 427, 517, 427, 427, 427, 427, 427, 427, 517 }; int index = rand.Next(0, numbers.Length); int number = numbers[index]; enemy.Update(enemy.Left -= 70, number); } }
public void Build(CCar car) { m_wheelsCount = 2; foreach (Transform child in m_container) { Destroy(child.gameObject); } foreach (WheelJoint2D joint in gameObject.GetComponents <WheelJoint2D>()) { Destroy(joint); } for (int i = 0; i < car.details.Count; ++i) { var detail = car.details[i]; var adress = car.addreses[i]; InstantiateDetail(adress.x, adress.y, new CDetail(detail)); } }
//------------------- public RacingGame() { InitializeComponent(); this.Cursor = new Cursor(Resources.HandCursor.GetHicon()); axBackground.Ctlcontrols.stop(); axForeGround.Ctlcontrols.play(); record = 1; steps = new CSteps[15]; for (int x = 0, y = 0; x < steps.Length; x++, y += 150) { steps[x] = new CSteps { Left = y, Top = 501 } } ; menu = new CMenu { Left = 680, Top = -10 }; foreground = new CForeground { Left = 0, Top = 0 }; scoreFrame = new CScoreFrame { Left = 261, Top = 106 }; background = new CBackground { Left = -5, Top = -300 }; enemy = new CCar { Left = FIRST_POSITION_ENEMY_X, Top = FIRST_POSITION_ENEMY_Y }; player = new CPlayer { Left = FIRST_POSITION_PLAYER_X, Top = FIRST_POSITION_PLAYER_Y }; enemySecond = new CCar { Left = FIRST_POSITION_ENEMY_X, Top = 517 }; }
static void OnProcess(CCar loader, float progress) { var loadingEvent = _instance.loadingEvent; loadingEvent.target = _instance; if (totalLoading <= 0) loadingEvent.total = 1; else loadingEvent.total = totalLoading; if (loadingEvent.current < currentLoaded) loadingEvent.current = currentLoaded; loadingEvent.progress = progress; if (_instance && _instance.OnProgress != null && totalLoading > 0) { _instance.OnProgress(_instance, loadingEvent); } }
static void LoadError(CCar cloader, CRequest req) { downloadings.Remove(req.udKey); if (req.times < 2) { //req.priority = req.priority - 10; realyLoadingQueue.Enqueue(req); } else { CallbackError(req); BeginQueue(); CheckAllComplete(); } }
static void LoadComplete(CCar loader, CRequest creq) { //Debug.LogFormat(" <color=green>LoadComplete {0} {1}</color>", creq.key, creq.isShared); downloadings.Remove(creq.udKey); if (creq.isShared) { //添加引用计数 RemoveReferenceRecord(creq); //回调 if (_instance && _instance.OnSharedComplete != null) _instance.OnSharedComplete(creq); } else { CallbackAsyncList(creq); } }
/// <summary> /// 获取空闲的loader /// </summary> /// <returns></returns> public static void CreateFreeLoader() { for (int i = loaderPool.Count; i < maxLoading; i++) { CCar cts = new CCar(); loaderPool.Add(cts); cts.OnComplete = LoadComplete; cts.OnError = LoadError; cts.OnProcess = OnProcess; } }