Ejemplo n.º 1
0
        public static World CreateCell(out WizardManager manager)
        {
            World world = new World();
            manager = new WizardManager(world);

            EmptyCellFactory ecf = new EmptyCellFactory();
            ecf.Finish += world.FillWorld;
            ecf.CreateListUnits(AmountEmptyCell, world);

            WayFactory wayF = new WayFactory();
            wayF.Finish += world.FillWorld;
            wayF.CreateListUnits(AmountWay, world);

            WizardFactory wf = new WizardFactory();
            wf.CreateHero += manager.InitHero;
            wf.Finish += world.FillWorld;
            wf.CreateListUnits(AmountHero, world);

            EnemyFactory ef = new EnemyFactory();
            ef.Finish += world.FillWorld;
            ef.CreateListUnits(AmountEnemy, world);

            SmithFactory sf = new SmithFactory();
            sf.Finish += world.FillWorld;
            sf.CreateListUnits(AmountFriend, world);

            CatFactory cf = new CatFactory();
            cf.Finish += world.FillWorld;
            cf.CreateListUnits(AmountFriend, world);

            return world;
        }
Ejemplo n.º 2
0
        public static void PrintWorld(Cell[,] cells, WizardManager heroManager)
        {
            for (int i = 0; i < cells.GetLength(0); ++i)
            {
                for (int j = 0; j < cells.GetLength(1); ++j)
                {
                    if (cells[i, j] is Wizard)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkCyan;
                        Console.Write(cells[i, j]);
                        Console.ForegroundColor = ConsoleColor.Gray;
                    }

                    else if (cells[i, j] is Enemy)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write(cells[i, j]);
                        Console.ForegroundColor = ConsoleColor.Gray;
                    }

                    else if (cells[i, j] is Friend)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        Console.Write(cells[i, j]);
                        Console.ForegroundColor = ConsoleColor.Gray;
                    }

                    else
                    {
                        Console.Write(cells[i, j]);
                    }
                }
                Console.WriteLine();
            }
            PrintText(heroManager);
        }
Ejemplo n.º 3
0
 public void ShowWorld(WizardManager heroManager)
 {
     View.PrintWorld(_cells, heroManager);
 }
Ejemplo n.º 4
0
        private static void PrintText(WizardManager wizardManager)
        {
            Console.Write("Health:{0}\t", wizardManager._wizard.Health);
            Console.Write("Mana:{0}\t\t", wizardManager._wizard.Mana);
            Console.WriteLine("Armor:{0}", wizardManager._wizard.Armor);
            Console.Write("Level:{0}\t", wizardManager._wizard.Level);

            string process = "[";

            for (int i = 0; i < (100 - wizardManager._wizard.FractionLevel) / 2; ++i)
            {
                process += "*";
            }

            for (int i = 0; i < wizardManager._wizard.FractionLevel / 2; ++i)
            {
                process += " ";
            }

            process += "] ";

            Console.WriteLine(process);
        }