Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace work
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int currentWeapon = 0;
- int deletingWeapon;
- string[] weaponsName = new string[0];
- int[] weaponsDamage = new int[0];
- int[] weaponsSpeed = new int[0];
- Console.SetCursorPosition(45, 2);
- Console.WriteLine("Арсенал ");
- Console.SetCursorPosition(3, 4);
- Console.WriteLine("Экирировано: Ничего");
- Console.SetCursorPosition(3, 5);
- Console.WriteLine("Скорострельность: нет");
- Console.SetCursorPosition(3, 6);
- Console.WriteLine("Урон: нет");
- Console.SetCursorPosition(3, 8);
- Console.WriteLine("МЕНЮ ");
- Console.SetCursorPosition(3, 9);
- Console.WriteLine("1) Добавить оружие ");
- Console.SetCursorPosition(3, 10);
- Console.WriteLine("2) Удалить оружие ");
- Console.SetCursorPosition(3, 11);
- Console.WriteLine("3) Экипировать оружие ");
- Console.SetCursorPosition(75, 10);
- Console.Write("Инвентарь");
- do
- {
- for (int i = 0; i < weaponsName.Length; i++)
- {
- Console.SetCursorPosition(85, 10 + 1 * i);
- Console.Write(" " + (i + 1) + " " + weaponsName[i]);
- }
- Console.SetCursorPosition(0, 12);
- Console.WriteLine(" ");
- Console.SetCursorPosition(0, 12);
- ConsoleKeyInfo userInput = Console.ReadKey();
- switch (userInput.Key)
- {
- case ConsoleKey.D1:
- if (weaponsName.Length > 8)
- {
- Console.SetCursorPosition(5, 14);
- Console.WriteLine("Инвентарь заполнен ");
- break;
- }
- string[] tempWeaponName = new string[weaponsName.Length + 1];
- for (int i = 0; i < weaponsName.Length; i++)
- {
- tempWeaponName[i] = weaponsName[i];
- }
- switch (random.Next(0, 3))
- {
- case 0:
- tempWeaponName[weaponsName.Length] = "Плазмо";
- break;
- case 1:
- tempWeaponName[weaponsName.Length] = "Луче";
- break;
- case 2:
- tempWeaponName[weaponsName.Length] = "Мега";
- break;
- }
- switch (random.Next(0, 3))
- {
- case 0:
- tempWeaponName[weaponsName.Length] = tempWeaponName[weaponsName.Length] + "бластер ";
- break;
- case 1:
- tempWeaponName[weaponsName.Length] = tempWeaponName[weaponsName.Length] + "мёт ";
- break;
- case 2:
- tempWeaponName[weaponsName.Length] = tempWeaponName[weaponsName.Length] + "Тесак ";
- break;
- }
- weaponsName = tempWeaponName;
- int[] tempWeaponsDamage = new int[weaponsDamage.Length + 1];
- for (int i = 0; i < weaponsDamage.Length; i++)
- {
- tempWeaponsDamage[i] = weaponsDamage[i];
- }
- tempWeaponsDamage[weaponsDamage.Length] = random.Next(10, 99);
- weaponsDamage = tempWeaponsDamage;
- int[] tempWeaponsSpeed = new int[weaponsSpeed.Length + 1];
- for (int i = 0; i < weaponsSpeed.Length; i++)
- {
- tempWeaponsSpeed[i] = weaponsSpeed[i];
- }
- tempWeaponsSpeed[weaponsSpeed.Length] = random.Next(10, 99);
- weaponsSpeed = tempWeaponsSpeed;
- Console.SetCursorPosition(5, 14);
- Console.Write("Добавлен " + weaponsName[weaponsName.Length - 1]);
- Console.SetCursorPosition(40, 14);
- Console.Write("скорострельность " + weaponsSpeed[weaponsSpeed.Length - 1] + " ");
- Console.SetCursorPosition(60, 14);
- Console.Write(" урон " + weaponsDamage[weaponsDamage.Length - 1] + " ");
- break;
- case ConsoleKey.D2:
- if (weaponsName.Length == 0)
- {
- Console.SetCursorPosition(5, 14);
- Console.WriteLine("Инвентарь пуст ");
- break;
- }
- Console.SetCursorPosition(0, 12);
- Console.Write("выберите оружие из инвентаря ");
- deletingWeapon = Convert.ToInt32(Console.ReadLine());
- if (currentWeapon == deletingWeapon)
- {
- Console.SetCursorPosition(3, 4);
- Console.WriteLine("Экирировано: Ничего ");
- Console.SetCursorPosition(3, 5);
- Console.WriteLine("Скорострельность: нет");
- Console.SetCursorPosition(3, 6);
- Console.WriteLine("Урон: нет");
- Console.SetCursorPosition(3, 8);
- }
- if (deletingWeapon > weaponsName.Length)
- {
- Console.SetCursorPosition(5, 14);
- Console.WriteLine("Нет такого оружия ");
- break;
- }
- Console.SetCursorPosition(5, 14);
- Console.Write("Удалён " + weaponsName[deletingWeapon - 1] + " ");
- string[] delWeaponName = new string[weaponsName.Length - 1];
- int[] delWeaponsDamage = new int[weaponsDamage.Length - 1];
- int[] delWeaponsSpeed = new int[weaponsSpeed.Length - 1];
- for (int i = 0; i < deletingWeapon - 1; i++)
- {
- delWeaponName[i] = weaponsName[i];
- delWeaponsDamage[i] = weaponsDamage[i];
- delWeaponsSpeed[i] = weaponsSpeed[i];
- }
- for (int i = deletingWeapon - 1; i < delWeaponName.Length; i++)
- {
- delWeaponName[i] = weaponsName[i + 1];
- delWeaponsDamage[i] = weaponsDamage[i + 1];
- delWeaponsSpeed[i] = weaponsSpeed[i + 1];
- }
- weaponsName = delWeaponName;
- weaponsDamage = delWeaponsDamage;
- weaponsSpeed = delWeaponsSpeed;
- Console.SetCursorPosition(85, 10 + 1 * weaponsName.Length);
- Console.Write(" ");
- break;
- case ConsoleKey.D3:
- Console.SetCursorPosition(0, 12);
- Console.Write("выберите оружие из инвентаря ");
- currentWeapon = Convert.ToInt32(Console.ReadLine());
- if (currentWeapon > weaponsName.Length)
- {
- Console.SetCursorPosition(5, 14);
- Console.WriteLine("Такого оружия нет ");
- break;
- }
- Console.SetCursorPosition(3, 4);
- Console.WriteLine("Экирировано: " + weaponsName[currentWeapon - 1]);
- Console.SetCursorPosition(3, 5);
- Console.WriteLine("Скорострельность: " + weaponsSpeed[currentWeapon - 1] + " ");
- Console.SetCursorPosition(3, 6);
- Console.WriteLine("Урон: " + weaponsDamage[currentWeapon - 1] + " ");
- break;
- default:
- Console.SetCursorPosition(0, 20);
- Console.WriteLine("ERROR");
- break;
- }
- } while (true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement