Esempio n. 1
0
        public void Run()
        {
            while (isRunning)
            {
                if (state == State.OPTIONS)
                {
                    Console.WriteLine("\n- - - - - Main Menu - - - - -  ");
                    Console.WriteLine("\n (1): Create Zombies  ");
                    Console.WriteLine(" (2): Demo gameplay ");

                    var mode = Console.ReadLine();


                    if (mode == "1")
                    {
                        create.isRunning = true;
                        Console.WriteLine(" (1) - Zombie creation selected.  \n");
                        Console.WriteLine(" [NOTE] - Press 'q' at any point to stop creating zombies.  \n");
                        Console.WriteLine("  Available Zombie types:  ");
                        Console.WriteLine("   (1): Regular  ");
                        Console.WriteLine("   (2): Cone  ");
                        Console.WriteLine("   (3): Bucket  ");
                        Console.WriteLine("   (4): ScreenDoor  ");
                        state = State.CREATE;
                    }
                    else if (mode == "2")
                    {
                        Console.WriteLine(" (2) - Demo selected.  \n");
                        Console.WriteLine(" [NOTE] - Press 'q' at any time to exit.\n");

                        gameObjectManager.PrintZombies();

                        demo.isRunning = true;
                        state          = State.DEMO;
                    }
                    else
                    {
                        Console.WriteLine(" [!] - INVALID INPUT. Input an integer between 1-2.");
                    }
                }
                if (state == State.CREATE)
                {
                    create.Update();
                    if (create.IsRunning == false)
                    {
                        state = State.OPTIONS;
                    }
                }
                if (state == State.DEMO)
                {
                    demo.Update(damageValue);
                    if (!demo.IsRunning)
                    {
                        state = State.OPTIONS;
                    }
                }
            }
        }
        public void Tick(int damageValue)
        {
            gameObjectManager.CheckEmpty();
            Console.WriteLine("\n Select an attack: \n  (1) Peashooter\n  (2) Watermelon\n  (3) Magnet-shrooms\n");

            var inp = Console.ReadLine();

            if (inp == "q")
            {
                Stop();
            }
            gameEventManager.SimulateCollisionDetection(Int32.Parse(inp));
            gameObjectManager.Update();
            gameObjectManager.PrintZombies();
            gameObjectManager.CheckEmpty();
        }
        public void Tick()
        {
            Console.Write("\n  Input Zombie type integer:  ");
            var accessoryType = Console.ReadLine();

            if (accessoryType == "q")
            {
                Stop();
                return;
            }

            if (accessoryType != "1" && accessoryType != "2" && accessoryType != "3" && accessoryType != "4")
            {
                Console.WriteLine(" [!] - INVALID INPUT. Input an integer between 1-4 or 'q' to stop adding zombies.");
                return;
            }
            gameObjectManager.AddZombie(AccessoryFactory.CreateZombie(accessoryType));
            gameObjectManager.PrintZombies();
        }