예제 #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));
 }