示例#1
0
        public void BuyStuff(Toys toy, Medicine meds)
        {
            Console.WriteLine("Buy things");

            int key = Convert.ToInt32(Console.ReadLine());

            if (key == 1)
            {
                toy = Dependancy.CreateBall();
                UpdateCoin(toy);
                bag.toysPurchased.Add(toy);
            }
            else if (key == 2)
            {
                toy = Dependancy.CreateSlipper();
                UpdateCoin(toy);
                bag.toysPurchased.Add(toy);
            }
            else if (key == 3)
            {
                meds = Dependancy.CreateCheapMeds();
                UpdateCoinMeds(meds);
                bag.medicineList.Add(meds);
            }
            else if (key == 4)
            {
                meds = Dependancy.CreateExpMedicine();
                UpdateCoinMeds(meds);
                bag.medicineList.Add(meds);
            }
            else
            {
                Console.WriteLine("Ya did nuffin");
            }
        }
示例#2
0
        public void SelectPet()
        {
            Pet pet;

            Console.WriteLine("Select a pet");
            Console.WriteLine("1. Snake");
            Console.WriteLine("2. Penguin");
            int selection = Convert.ToInt32(Console.ReadLine());

            if (selection == 1)
            {
                Console.WriteLine("Snakey! I choose you!");
                pet = Dependancy.CreateSnake();
                AddPetToRoom(pet);
                Console.ReadKey(true);
            }
            else if (selection == 2)
            {
                Console.WriteLine("Pengu! I choose you!");
                pet = Dependancy.CreatePenguin();
                AddPetToRoom(pet);
                Console.ReadKey(true);
            }
            else
            {
                Console.WriteLine("Invalid Choice");
                Console.WriteLine("You're a terrible person and don't deserve a pet. Good bye");
                Console.ReadKey(true);
                appState = AppState.Exiting;
            }
        }
示例#3
0
 public App()
 {
     this.bag  = Dependancy.CreateInventory(room);
     this.shop = Dependancy.CreateShop(bag);
 }