Пример #1
0
 Door(int x, int y, ConsoleColor fore, bool isOpened)
 {
     this.x        = x;
     this.y        = y;
     this.isOpened = isOpened;
     this.icon     = CIcon.Tile(fore, ConsoleColor.Black, isOpened? openedChar : closedChar);
 }
Пример #2
0
        public void repaint(List <Dot> updateOnly)
        {
            var p = zeroPriorities;

            foreach (CDrawable cd in objects)
            {
                int x = cd.X, y = cd.Y;
                //if (!dotNeedsUpdate(updateOnly, x, y))
                //    continue;
                if (!isIn(x, y))
                {
                    continue;
                }
                CIcon ic = cd.Icon;
                if (p[x][y].priority > ic.priority)
                {
                    // if this is background then draw a color
                    if (ic.isBackround && !p[x][y].isBackround)
                    {
                        p[x][y].back = ic.back;
                    }
                    // get a color of prioritet background
                    continue;
                }
                if (p[x][y].priority == -1)
                { // if default
                    p[x][y] = ic;
                    continue;
                }
                // if there is anything behind this new symbol
                if (ic.isBackround && p[x][y].isBackround)
                {
                    p[x][y] = ic;
                    continue;
                }
                p[x][y].fore     = ic.fore;
                p[x][y].c        = ic.c;
                p[x][y].priority = ic.priority;
            }
            for (int i = 0; i < wid; ++i)
            {
                for (int j = 0; j < hei; ++j)
                {
                    bool needRepaint = dotNeedsUpdate(updateOnly, i, j);
                    Console.SetCursorPosition(0, 0);

                    //Console.SetCursorPosition(startX + i, startY + hei + 4 + j);
                    //Console.BackgroundColor = ConsoleColor.Black;
                    //Console.Write(needRepaint? 'X':'.');

                    if (!needRepaint)
                    {
                        continue;
                    }
                    Console.SetCursorPosition(startX + i, startY + j);
                    p[i][j].Repaint();
                }
            }
            Console.ResetColor();
        }
Пример #3
0
 Unit(int x, int y, CIcon icon, UnitMind mind, Team team)
 {
     this.x         = x;
     this.y         = y;
     this.icon      = icon;
     this.mind      = mind;
     this.mind.host = this;
     this.team      = team;
 }
Пример #4
0
 static public Tile grassTile(int x, int y)
 {
     return(new Tile(x, y, CIcon.Tile(ConsoleColor.DarkGreen, ConsoleColor.Black, ',')));
 }
Пример #5
0
 static public Tile stoneTile(int x, int y)
 {
     return(new Tile(x, y, CIcon.Tile(ConsoleColor.DarkBlue, ConsoleColor.Black, '.')));
 }
Пример #6
0
 Tile(int x, int y, CIcon icon)
 {
     this.x    = x;
     this.y    = y;
     this.icon = icon;
 }
Пример #7
0
 static public Unit neutralGnome(int x, int y)
 {
     return(new Unit(x, y, CIcon.Character(ConsoleColor.DarkGray, 'o'), new NoMind(), Team.neutral));
 }
Пример #8
0
 static public Unit enemyGoblinPatrol(int x, int y, MoveDirection defaultDirection)
 {
     return(new Unit(x, y, CIcon.Character(ConsoleColor.DarkGreen, 'à'), new WalkByDirection(defaultDirection), Team.enemy));
 }
Пример #9
0
 static public Unit enemyGoblin(int x, int y)
 {
     return(new Unit(x, y, CIcon.Character(ConsoleColor.DarkGreen, 'a'), new NoMind(), Team.enemy));
 }
Пример #10
0
 static public Unit player(int x, int y)
 {
     return(new Unit(x, y, CIcon.CharacterPlayer(ConsoleColor.Red, 'ì'), new Controller(), Team.player));
 }