Exemple #1
0
        public void GenerateMedHelp(int count)
        {
            int x, y;

            while (count > 0)
            {
                Random rnd = new Random();
                x = rnd.Next(1, Width);
                y = rnd.Next(1, Height);
                if (place[x, y] == null)
                {
                    place[x, y] = new MedHelp(x, y);
                    count--;
                }
                else
                {
                    continue;
                }
            }
        }
Exemple #2
0
        static void DrawField(Field field, int x, int y)
        {
            var v = field.place[x, y];

            if (v == null)
            {
                Console.SetCursorPosition(x, y);
                Console.WriteLine(" ");
            }
            else if (v != null)
            {
                if (v.GetType() == typeof(Wall))
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    Wall w = (Wall)v;
                    Console.SetCursorPosition(w.point.X, w.point.Y);
                    Console.WriteLine(w.Symbol);
                }
                if (v.GetType() == typeof(Death))
                {
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Death w = (Death)v;
                    Console.SetCursorPosition(w.point.X, w.point.Y);
                    Console.WriteLine(w.Symbol);
                }
                else if (v.GetType() == typeof(MedHelp))
                {
                    Console.ForegroundColor = ConsoleColor.DarkMagenta;
                    MedHelp w = (MedHelp)v;
                    Console.SetCursorPosition(w.point.X, w.point.Y);
                    Console.WriteLine(w.Symbol);
                }
                else if (v.GetType() == typeof(Teleport))
                {
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Teleport w = (Teleport)v;
                    Console.SetCursorPosition(w.point.X, w.point.Y);
                    Console.WriteLine(w.Symbol);
                }
                else if (v.GetType() == typeof(Player))
                {
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Player p = (Player)v;
                    Console.SetCursorPosition(p.X, p.Y);
                    Console.WriteLine(p.Symbol);
                }
                else if (v.GetType() == typeof(Enemy))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Enemy p = (Enemy)v;
                    Console.SetCursorPosition(p.point.X, p.point.Y);
                    Console.WriteLine(p.Symbol);
                }
                else if (v.GetType() == typeof(Prize))
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Prize p = (Prize)v;
                    Console.SetCursorPosition(p.point.X, p.point.Y);
                    Console.WriteLine(p.Symbol);
                }
                else if (v.GetType() == typeof(BreakPoint))
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    BreakPoint p = (BreakPoint)v;
                    Console.SetCursorPosition(p.point.X, p.point.Y);
                    Console.WriteLine(p.Symbol);
                }
            }
            Console.ResetColor();
        }