Example #1
0
        /// <summary>
        /// Constructor, that creates a new instance of ConsoleRenderer and
        /// initializes its members. Constructor for game.
        /// </summary>
        /// <param name="xdim">Horizontal dimension of the scene.</param>
        /// <param name="ydim">Vertical dimension of the scene.</param>
        /// <param name="bgPix">Default ConsolePixel for the background.</param>
        /// <param name="collision">Reference to a collision class.</param>
        /// <param name="name">Name of the ConsoleRenderer object.</param>
        public ConsoleRenderer(
            int xdim,
            int ydim,
            ConsolePixel bgPix,
            Collision collision,
            string name = "")
        {
            cursorVisibleBefore = true;
            this.xdim           = xdim;
            this.ydim           = ydim;
            this.bgPix          = bgPix;
            Name         = name;
            gameObjects  = new List <GameObject>();
            currentFrame = new ConsolePixel[xdim, ydim];
            nextFrame    = new ConsolePixel[xdim, ydim];
            collisions   = collision;
            for (int y = 0; y < ydim; y++)
            {
                for (int x = 0; x < xdim; x++)
                {
                    nextFrame[x, y] = bgPix;
                }
            }

            inGame = true;
        }
Example #2
0
        public void ConsolePixelDataIsSet()
        {
            var consolePixelData = new ConsolePixelData();

            // act
            var consolePixel = new ConsolePixel(consolePixelData);

            Assert.AreEqual(consolePixelData, consolePixel.Data);
        }
Example #3
0
        /// <summary>
        /// Renders the actual frame.
        /// </summary>
        private void RenderFrame()
        {
            // Background and foreground colors of each pixel
            ConsoleColor fgColor, bgColor;

            // Auxiliary frame variable for swapping buffers in the end
            ConsolePixel[,] auxFrame;

            // Show frame in screen
            Console.SetCursorPosition(0, 0);

            for (int y = 0; y < ydim; y++)
            {
                for (int x = 0; x < xdim; x++)
                {
                    // Get current and previous pixels for this position
                    ConsolePixel pix     = nextFrame[x, y];
                    ConsolePixel prevPix = currentFrame[x, y];

                    // Clear pixel at previous frame
                    currentFrame[x, y] = bgPix;

                    // If current pixel is not renderable, use background pixel
                    if (!pix.IsRenderable)
                    {
                        pix = bgPix;
                    }

                    // If current pixel is the same as previous pixel, don't
                    // draw it
                    if (pix.Equals(prevPix) && !pix.Equals(bgPix))
                    {
                        continue;
                    }

                    bgColor = pix.BackgroundColor;
                    Console.BackgroundColor = bgColor;

                    fgColor = pix.ForegroundColor;
                    Console.ForegroundColor = fgColor;

                    // Position cursor
                    Console.SetCursorPosition(x, y);

                    // Render pixel
                    Console.Write(pix.Shape);
                }

                // New line
                Console.WriteLine();
            }

            // Swap frame buffers
            auxFrame     = currentFrame;
            currentFrame = nextFrame;
            nextFrame    = auxFrame;
        }
Example #4
0
 private Tetromino(char name, char draw, char uni, Color colour, Color bg, IMask bricks)
 {
     Name       = name;
     UniDraw    = uni;
     Draw       = draw;
     Colour     = colour;
     Background = bg;
     Bricks     = bricks;
     Style      = new ConsolePixel(draw, colour, bg);
 }
 public static void DrawSprite(this IRenderer <ConsolePixel> render, int x, int y, string[] sprite, Color fg, Color bg)
 {
     for (var a = 0; a < sprite.Length; a++)
     {
         for (var b = 0; b < sprite[a].Length; b++)
         {
             render[x + b, y + a] = new ConsolePixel(sprite[a][b], fg, bg);
         }
     }
 }
Example #6
0
    public void RenderMenu()
    {
        ConsoleColor f = ConsoleColor.Gray;
        ConsoleColor b = ConsoleColor.Black;

        char[] label;
        string content;

        ConsoleMenuController temp = (ConsoleMenuController)MasterControlProgram.GetController();

        for (int i = 0; i < uiContent.GetLength(0); i++)
        {
            for (int j = 0; j < uiContent.GetLength(1); j++)
            {
                uiContent[i, j] = new ConsolePixel();
            }
        }

        content = "CONSOLE DUNGEON CRAWLER : MAIN MENU";
        label   = content.ToCharArray();
        for (int i = 0; i < label.Length; i++)
        {
            f = ConsoleColor.Green;
            uiContent[0, i] = new ConsolePixel(label[i], f);
        }

        if (temp.states.Count > 0)
        {
            for (int i = 0; i < temp.states.Count; i++)
            {
                content = temp.states[i].ToString();
                label   = content.ToCharArray();

                for (int j = 0; j < label.Length; j++)
                {
                    if (i == temp.index)
                    {
                        f = ConsoleColor.Gray;
                        b = ConsoleColor.Magenta;
                    }
                    else
                    {
                        f = ConsoleColor.Gray;
                        b = ConsoleColor.Black;
                    }

                    uiContent[1 + i, j] = new ConsolePixel(label[j], f, b);
                }
            }
        }
    }
Example #7
0
        public void Clone_Clones()
        {
            var consolePixelData = new ConsolePixelData {
                Colour = 'A'
            };
            var consolePixel = new ConsolePixel(consolePixelData);

            // act
            var result = consolePixel.Clone();

            Assert.AreNotEqual(result, consolePixel);
            Assert.AreNotEqual(result.Data, consolePixel.Data);
            Assert.AreEqual(result.Data.Colour, consolePixel.Data.Colour);
        }
Example #8
0
        public void SetColour_SetsColour()
        {
            var consolePixelData = new ConsolePixelData {
                Colour = 'A'
            };
            var consolePixel = new ConsolePixel(consolePixelData);

            var consolePixelDataReference = new ConsolePixelData {
                Colour = 'B'
            };
            var consolePixelReference = new ConsolePixel(consolePixelDataReference);

            // act
            consolePixel.SetColour(consolePixelReference);

            Assert.AreEqual(consolePixelDataReference.Colour, consolePixelData.Colour);
        }
Example #9
0
        public void IsColour_Match_ReturnsTrue()
        {
            var consolePixelData = new ConsolePixelData {
                Colour = 'A'
            };
            var consolePixel = new ConsolePixel(consolePixelData);

            var consolePixelDataReference = new ConsolePixelData {
                Colour = 'A'
            };
            var consolePixelReference = new ConsolePixel(consolePixelDataReference);

            // act
            var result = consolePixel.IsColourMatch(consolePixelReference);

            Assert.IsTrue(result);
        }
Example #10
0
    public void RenderFinishScreen()
    {
        ConsoleColor f = ConsoleColor.Gray;
        ConsoleColor b = ConsoleColor.Black;

        char[] label;
        string content;

        for (int i = 0; i < uiContent.GetLength(0); i++)
        {
            for (int j = 0; j < uiContent.GetLength(1); j++)
            {
                uiContent[i, j] = new ConsolePixel();
            }
        }

        content = "GAME OVER : SCORE REACHED " + data.score.GetScore().ToString();
        label   = content.ToCharArray();
        for (int i = 0; i < label.Length; i++)
        {
            f = ConsoleColor.White;
            uiContent[0, i] = new ConsolePixel(label[i], f);
        }

        //Process all end game information here - I'M VERY SORRY, I KNOW ITS NOT 100% MODEL-VIEW-CONTROL

        content = "PRESS ANY KEY TO RETURN TO MAIN MENU";
        label   = content.ToCharArray();
        for (int i = 0; i < label.Length; i++)
        {
            f = ConsoleColor.Green;
            uiContent[1, i] = new ConsolePixel(label[i], f);
        }

        Console.ReadKey();
        Application.ChangeGameState(GameStates.MENU);
    }
Example #11
0
        /// <summary>
        /// Constructor for MenuCreation.
        /// </summary>
        /// <param name="keyReader">Reference to keyReader.</param>
        /// <param name="sceneHandler">Reference to sceneHandler.</param>
        /// <param name="random">Instance of a Random type object.</param>
        public MenuCreation(
            KeyReaderComponent keyReader,
            SceneHandler sceneHandler,
            Random random)
        {
            this.sceneHandler = sceneHandler;

            ConsolePixel backgroundPixel =
                new ConsolePixel(
                    ' ',
                    ConsoleColor.White,
                    ConsoleColor.DarkBlue);

            consoleRenderer = new ConsoleRenderer(
                XSIZE * 3,
                YSIZE,
                backgroundPixel,
                "Console Renderer");

            this.keyReader = keyReader;
            this.random    = random;

            MenuScene = new Scene();
        }
Example #12
0
        /// <summary>
        /// Creates obstacles game  Objects.
        /// </summary>
        public void BuildObstacles()
        {
            GameObject   obstacle      = new GameObject("Obstacle");
            ConsolePixel obstaclePixel = new ConsolePixel(
                ' ', ConsoleColor.Blue, ConsoleColor.Green);
            Dictionary <Vector2, ConsolePixel> obstaclePixels =
                new Dictionary <Vector2, ConsolePixel>();

            // Obstacle GreenTube 1
            obstaclePixels[new Vector2(34, 19)] = obstaclePixel;
            occupied.Add(new Vector2(34, 19));

            obstaclePixels[new Vector2(37, 19)] = obstaclePixel;
            occupied.Add(new Vector2(37, 19));

            obstaclePixels[new Vector2(35, 20)] = obstaclePixel;
            occupied.Add(new Vector2(35, 20));

            obstaclePixels[new Vector2(35, 21)] = obstaclePixel;
            occupied.Add(new Vector2(35, 21));

            obstaclePixels[new Vector2(35, 19)] = obstaclePixel;
            occupied.Add(new Vector2(35, 19));

            obstaclePixels[new Vector2(35, 22)] = obstaclePixel;
            occupied.Add(new Vector2(35, 22));

            obstaclePixels[new Vector2(36, 20)] = obstaclePixel;
            occupied.Add(new Vector2(36, 20));

            obstaclePixels[new Vector2(36, 21)] = obstaclePixel;
            occupied.Add(new Vector2(36, 21));

            obstaclePixels[new Vector2(36, 19)] = obstaclePixel;
            occupied.Add(new Vector2(36, 19));

            obstaclePixels[new Vector2(36, 22)] = obstaclePixel;
            occupied.Add(new Vector2(36, 22));

            // Obstacle GreenTube 2
            obstaclePixels[new Vector2(54, 19)] = obstaclePixel;
            occupied.Add(new Vector2(54, 19));

            obstaclePixels[new Vector2(57, 19)] = obstaclePixel;
            occupied.Add(new Vector2(57, 19));

            obstaclePixels[new Vector2(55, 20)] = obstaclePixel;
            occupied.Add(new Vector2(55, 20));

            obstaclePixels[new Vector2(55, 21)] = obstaclePixel;
            occupied.Add(new Vector2(55, 21));

            obstaclePixels[new Vector2(55, 19)] = obstaclePixel;
            occupied.Add(new Vector2(55, 19));

            obstaclePixels[new Vector2(55, 22)] = obstaclePixel;
            occupied.Add(new Vector2(55, 22));

            obstaclePixels[new Vector2(56, 20)] = obstaclePixel;
            occupied.Add(new Vector2(56, 20));

            obstaclePixels[new Vector2(56, 21)] = obstaclePixel;
            occupied.Add(new Vector2(56, 21));

            obstaclePixels[new Vector2(56, 19)] = obstaclePixel;
            occupied.Add(new Vector2(56, 19));

            obstaclePixels[new Vector2(56, 22)] = obstaclePixel;
            occupied.Add(new Vector2(56, 22));

            // Obstacle GreenTube 3
            obstaclePixels[new Vector2(84, 19)] = obstaclePixel;
            occupied.Add(new Vector2(84, 19));

            obstaclePixels[new Vector2(87, 19)] = obstaclePixel;
            occupied.Add(new Vector2(87, 19));

            obstaclePixels[new Vector2(85, 20)] = obstaclePixel;
            occupied.Add(new Vector2(85, 20));

            obstaclePixels[new Vector2(85, 21)] = obstaclePixel;
            occupied.Add(new Vector2(85, 21));

            obstaclePixels[new Vector2(85, 19)] = obstaclePixel;
            occupied.Add(new Vector2(85, 19));

            obstaclePixels[new Vector2(85, 22)] = obstaclePixel;
            occupied.Add(new Vector2(85, 22));

            obstaclePixels[new Vector2(86, 20)] = obstaclePixel;
            occupied.Add(new Vector2(86, 20));

            obstaclePixels[new Vector2(86, 21)] = obstaclePixel;
            occupied.Add(new Vector2(86, 21));

            obstaclePixels[new Vector2(86, 19)] = obstaclePixel;
            occupied.Add(new Vector2(86, 19));

            obstaclePixels[new Vector2(86, 22)] = obstaclePixel;
            occupied.Add(new Vector2(86, 22));

            obstacle.AddComponent(new ConsoleSprite(obstaclePixels));
            obstacle.AddComponent(new Position(0, 0, 0));
            gameScene.AddGameObject(obstacle);
        }
 public void Render(ConsolePixel view)
 {
     throw new NotImplementedException();
 }
Example #14
0
        private Game()
        {
            // Create scene
            ConsoleKey[] quitKeys = new ConsoleKey[] { ConsoleKey.Escape };
            gameScene = new Scene(xdim, ydim,
                                  new InputHandler(quitKeys),
                                  new ConsoleRenderer(xdim, ydim, new ConsolePixel('.')),
                                  new CollisionHandler(xdim, ydim));

            // Create quitter object
            GameObject  quitter = new GameObject("Quitter");
            KeyObserver quitSceneKeyListener = new KeyObserver(new ConsoleKey[]
                                                               { ConsoleKey.Escape });

            quitter.AddComponent(quitSceneKeyListener);
            quitter.AddComponent(new Quitter());
            gameScene.AddGameObject(quitter);

            // Create player object
            char[,] playerSprite =
            {
                { '-', '|', '-' },
                { '-', '0', '-' },
                { '-', '|', '-' }
            };
            GameObject  player            = new GameObject("Player");
            KeyObserver playerKeyListener = new KeyObserver(new ConsoleKey[] {
                ConsoleKey.DownArrow,
                ConsoleKey.UpArrow,
                ConsoleKey.RightArrow,
                ConsoleKey.LeftArrow
            });

            player.AddComponent(playerKeyListener);
            Position playerPos = new Position(10f, 10f, 0f);

            player.AddComponent(playerPos);
            player.AddComponent(new Player());
            player.AddComponent(new ConsoleSprite(
                                    playerSprite, ConsoleColor.Red, ConsoleColor.DarkGreen));
            gameScene.AddGameObject(player);

            // Create walls
            GameObject   walls     = new GameObject("Walls");
            ConsolePixel wallPixel = new ConsolePixel(
                '#', ConsoleColor.Blue, ConsoleColor.White);
            Dictionary <Vector2, ConsolePixel> wallPixels =
                new Dictionary <Vector2, ConsolePixel>();

            for (int x = 0; x < xdim; x++)
            {
                wallPixels[new Vector2(x, 0)] = wallPixel;
            }
            for (int x = 0; x < xdim; x++)
            {
                wallPixels[new Vector2(x, ydim - 1)] = wallPixel;
            }
            for (int y = 0; y < ydim; y++)
            {
                wallPixels[new Vector2(0, y)] = wallPixel;
            }
            for (int y = 0; y < ydim; y++)
            {
                wallPixels[new Vector2(xdim - 1, y)] = wallPixel;
            }
            walls.AddComponent(new ConsoleSprite(wallPixels));
            walls.AddComponent(new Position(0, 0, 1));
            gameScene.AddGameObject(walls);

            // Create game object for showing date and time
            GameObject dtGameObj = new GameObject("Time");

            dtGameObj.AddComponent(new Position(xdim / 2 + 1, 0, 10));
            RenderableStringComponent rscDT = new RenderableStringComponent(
                () => DateTime.Now.ToString("F"),
                i => new Vector2(i, 0),
                ConsoleColor.DarkMagenta, ConsoleColor.White);

            dtGameObj.AddComponent(rscDT);
            gameScene.AddGameObject(dtGameObj);

            // Create game object for showing position
            GameObject pos = new GameObject("Position");

            pos.AddComponent(new Position(1, 0, 10));
            RenderableStringComponent rscPos = new RenderableStringComponent(
                () => $"({playerPos.Pos.X}, {playerPos.Pos.Y})",
                i => new Vector2(i, 0),
                ConsoleColor.DarkMagenta, ConsoleColor.White);

            pos.AddComponent(rscPos);
            gameScene.AddGameObject(pos);
        }
Example #15
0
    public void RenderGame()
    {
        char symbol = ' ';

        offset = new Vector2((int)data.player.position.x - (viewH / 2), (int)data.player.position.y - (viewW / 2));

        //Console.Clear();
        ConsoleColor f = ConsoleColor.Gray;
        ConsoleColor b = ConsoleColor.Black;

        for (int i = 0; i < uiContent.GetLength(0); i++)
        {
            for (int j = 0; j < uiContent.GetLength(1); j++)
            {
                uiContent[i, j] = new ConsolePixel();
            }
        }

        //Player Health stuff
        for (int i = 0; i < data.player.maxHealth; i++)
        {
            if (i < data.player.health)
            {
                f = ConsoleColor.Red;
            }
            else
            {
                f = ConsoleColor.DarkGray;
            }

            uiContent[1, 0 + i] = new ConsolePixel('♥', f, b);
        }
        f = ConsoleColor.Gray;
        b = ConsoleColor.Black;
        /**/

        //Player Actions stuff
        int debug  = data.player.maxActions; // player.maxActions
        int debug2 = data.player.actions;    // player.Actions

        for (int i = 0; i < debug; i++)
        {
            if (i < debug2)
            {
                f = ConsoleColor.White;
            }
            else
            {
                f = ConsoleColor.DarkGray;
            }

            uiContent[1, data.player.maxHealth + 1 + i] = new ConsolePixel('>', f, b);
        }
        f = ConsoleColor.Gray;
        b = ConsoleColor.Black;
        /**/

        //Score stuff
        if (true)
        {
            string content = data.score.GetScore().ToString();
            char[] label   = content.ToCharArray();

            for (int i = 0; i < label.Length; i++)
            {
                f = ConsoleColor.White;
                uiContent[1, viewW - content.Length + i] = new ConsolePixel(label[i], f, b);
            }
        }
        f = ConsoleColor.Gray;
        b = ConsoleColor.Black;
        /**/
        //Ammo Stuff
        if (data.player.Weapon.content.currentammo > -1 && data.player.Weapon.content.ammo > -1)
        {
            string content = data.player.Weapon.content.currentammo.ToString() + "/" + data.player.Weapon.content.ammo;
            char[] label   = content.ToCharArray();

            for (int i = 0; i < label.Length; i++)
            {
                if (data.player.Weapon.content.currentammo == 0 && label[i].ToString().Equals("0"))
                {
                    f = ConsoleColor.Red;
                }
                else
                {
                    f = ConsoleColor.Gray;
                }
                uiContent[1, viewW - content.Length + i] = new ConsolePixel(label[i], f, b);
            }
        }
        else
        {
            string content = "melee";
            char[] label   = content.ToCharArray();

            for (int i = 0; i < label.Length; i++)
            {
                uiContent[1, viewW - content.Length + i] = new ConsolePixel(label[i], f, b);
            }
        }

        //Geography Render
        for (int i = 0; i < viewH; i++)
        {
            for (int j = 0; j < viewW; j++)
            {
                //Todo: Dont render whole level
                //
                //REALLY SIMPLE METHOD, CAN PROBABLY DO BETTER

                /*
                 * if (Vector2.Distance(new Vector2(i, j), data.player.position) > 5)
                 *  continue;
                 */

                int x = (int)offset.x + i;
                int y = (int)offset.y + j;

                if ((x >= 0 && x < data.level.structure.GetLength(0)) && (y >= 0 && y < data.level.structure.GetLength(1)))
                {
                    symbol = TILE_CHARS[data.level.structure[x, y].terrain];
                    //?+i/?+j for the level position offset
                    f = ConsoleColor.Gray;
                    b = ConsoleColor.Black;
                    uiContent[i + (int)loff.x, j] = new ConsolePixel(symbol, f, b);
                }

                /*
                 * else
                 * {
                 *  f = ConsoleColor.Black;
                 *  b = ConsoleColor.DarkGreen;
                 *  uiContent[i + (int)loff.x, j] = new ConsolePixel(' ', f, b);
                 * }
                 * /**/
            }
Example #16
0
        /// <summary>
        /// Add components to objets that compose the dungeon
        /// </summary>
        /// <param name="scene"> Accepts a Scene to add the components to
        /// </param>
        private void CreateDungeons(Scene scene)
        {
            GameObject  go      = scene.FindGameObjectByName("Dungeon");
            Dungeon     dungeon = go as Dungeon;
            GameObject  walls;
            GameObject  aux = null;         // Get previous gameObject (walls)
            Transform   wallTrans;          // Get walls Transform
            Transform   auxTrans;           // Previous gameObject transform
            DungeonRoom auxRoom = null;     // Get previous gameObject (room)
            int         index   = 1;

            Dictionary <Vector2, ConsolePixel> wallPixels;

            // Element's sprites
            char[,] doors = { { ' ' } };
            char[,] enemy = { { '☠' } }; // ☠

            // Foreach room create wall
            foreach (DungeonRoom room in dungeon.Rooms)
            {
                walls = new GameObject("Walls" + index);

                ConsolePixel wallPixel =
                    new ConsolePixel(' ', ConsoleColor.White,
                                     ConsoleColor.DarkYellow);

                wallPixels = new Dictionary <Vector2, ConsolePixel>();

                // WALLS
                for (int x = 0; x < room.Dim.X; x++)
                {
                    wallPixels[new Vector2(x, 0)] = wallPixel;
                }
                for (int x = 0; x < room.Dim.X; x++)
                {
                    wallPixels[new Vector2(x, room.Dim.Y - 1)] = wallPixel;
                }
                for (int y = 0; y < room.Dim.Y; y++)
                {
                    wallPixels[new Vector2(0, y)] = wallPixel;
                }
                for (int y = 0; y < room.Dim.Y; y++)
                {
                    wallPixels[new Vector2(room.Dim.X - 1, y)] = wallPixel;
                }

                float xdim;
                float ydim;
                int   xpos;
                int   xpos2;
                int   ypos;
                int   ypos2;

                // First room walls
                if (aux == null && auxRoom == null)
                {
                    xdim = 1;
                    ydim = _y / 6;

                    walls.AddComponent(new ConsoleSprite(wallPixels));
                    walls.AddComponent(new Transform(xdim, ydim, 1f));

                    xpos  = (int)xdim;
                    xpos2 = (int)xdim;
                    ypos  = (int)ydim;
                    ypos2 = (int)ydim;

                    // COLLIDERS
                    for (int x = 0; x < room.Dim.X; x++)
                    {
                        walls.AddComponent(new ObjectCollider(
                                               new Vector2(xpos, ydim)));
                        xpos++;
                        //Console.Write($"Col {x}: {xpos}, {ydim}");
                    }
                    for (int x = 0; x < room.Dim.X; x++)
                    {
                        walls.AddComponent(new ObjectCollider(
                                               new Vector2(xpos2, ydim + room.Dim.Y - 1)));
                        xpos2++;
                    }
                    for (int y = 0; y < room.Dim.Y; y++)
                    {
                        walls.AddComponent(new ObjectCollider(
                                               new Vector2(xdim, ypos)));
                        ypos++;
                    }
                    for (int y = 0; y < room.Dim.Y; y++)
                    {
                        walls.AddComponent(new ObjectCollider(
                                               new Vector2(xdim + room.Dim.X - 1, ypos2)));
                        ypos2++;
                    }

                    aux     = walls;
                    auxRoom = room;
                }
                else
                {
                    auxTrans = aux.GetComponent <Transform>();

                    // X of room is taken from the previus walls
                    // and room dimensions
                    xdim = Math.Clamp(
                        auxTrans.Pos.X + auxRoom.Dim.X - 1, 0, _x - 2);

                    // Y of room is taken from the previus walls and doors
                    // In relation with the center of the current room
                    ydim = auxTrans.Pos.Y + (auxRoom.Dim.Y / 2)
                           - (room.Dim.Y / 2);

                    // Make sure the room doesn't get out of bounds
                    if (auxTrans.Pos.X + auxRoom.Dim.X + room.Dim.X <= _x)
                    {
                        // Add the sprite and transform to assign position
                        walls.AddComponent(new ConsoleSprite(wallPixels));
                        walls.AddComponent(new Transform(xdim, ydim, 1f));

                        xpos  = (int)xdim;
                        xpos2 = (int)xdim;
                        ypos  = (int)ydim;
                        ypos2 = (int)ydim;

                        // COLLIDERS
                        for (int x = 0; x < room.Dim.X; x++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xpos, ydim)));
                            xpos++;
                        }
                        for (int x = 0; x < room.Dim.X; x++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xpos2, ydim + room.Dim.Y - 1)));
                            xpos2++;
                        }
                        for (int y = 0; y < room.Dim.Y; y++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xdim, ypos)));
                            ypos++;
                        }
                        for (int y = 0; y < room.Dim.Y; y++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xdim + room.Dim.X - 1, ypos2)));
                            ypos2++;
                        }
                    }
                    else
                    {
                        xdim = 1;
                        ydim = _y / 2;

                        walls.AddComponent(new ConsoleSprite(wallPixels));
                        walls.AddComponent(new Transform(xdim, ydim, 1f));

                        xpos  = (int)xdim;
                        xpos2 = (int)xdim;
                        ypos  = (int)ydim;
                        ypos2 = (int)ydim;

                        // COLLIDERS
                        for (int x = 0; x < room.Dim.X; x++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xpos, ydim)));
                            xpos++;
                        }
                        for (int x = 0; x < room.Dim.X; x++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xpos2, ydim + room.Dim.Y - 1)));
                            xpos2++;
                        }
                        for (int y = 0; y < room.Dim.Y; y++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xdim, ypos)));
                            ypos++;
                        }
                        for (int y = 0; y < room.Dim.Y; y++)
                        {
                            walls.AddComponent(new ObjectCollider(
                                                   new Vector2(xdim + room.Dim.X - 1, ypos2)));
                            ypos2++;
                        }
                    }

                    aux     = walls;
                    auxRoom = room;
                }

                scene.AddGameObject(walls);

                wallTrans = walls.GetComponent <Transform>();

                // DOORS IN ROOM
                for (int i = 0; i < room.Doors.Length; i++)
                {
                    // Assign door name
                    room.Doors[i].Name += i;
                    room.Doors[i].Name += index;

                    // Add sprite to door
                    room.Doors[i].AddComponent(new ConsoleSprite(
                                                   doors, ConsoleColor.White, ConsoleColor.Yellow));

                    if (i % 2 == 0)
                    {
                        // Add transform corresponding to the room it's in - X
                        room.Doors[i].AddComponent(
                            new Transform(wallTrans.Pos.X,
                                          wallTrans.Pos.Y + (room.Dim.Y / 2), 2));
                    }
                    else
                    {
                        // Add transform corresponding to the room it's in - Y
                        room.Doors[i].AddComponent(
                            new Transform(wallTrans.Pos.X + (room.Dim.X / 2),
                                          wallTrans.Pos.Y + room.Dim.Y - 1, 2));
                    }

                    scene.AddGameObject(room.Doors[i]);
                }

                // ENEMIES IN ROOM
                for (int i = 0; i < room.Enemies.Length; i++)
                {
                    int enemyX = Convert.ToInt32
                                     (wallTrans.Pos.X + (room.Dim.X / 2) + i);
                    int enemyY = Convert.ToInt32
                                     (wallTrans.Pos.Y + (room.Dim.Y / 2));

                    room.Enemies[i].Name += i;
                    room.Enemies[i].Name += index;

                    room.Enemies[i].AddComponent(new ConsoleSprite(
                                                     enemy, ConsoleColor.White, ConsoleColor.Red));

                    room.Enemies[i].AddComponent(
                        new Transform(enemyX, enemyY, 2f));

                    room.Enemies[i].AddComponent(
                        new ObjectCollider());

                    room.Enemies[i].AddComponent(new EnemyController(_rnd));

                    scene.AddGameObject(room.Enemies[i]);
                }

                index++;
            }
        }
Example #17
0
        /// <summary>
        /// Creates the first Level GameObjects.
        /// </summary>
        private void CreateLevel()
        {
            // Create scene
            ConsoleKey[] quitKeys = new ConsoleKey[] { ConsoleKey.Escape };
            gameScene = new Scene(
                xdim,
                ydim,
                new InputHandler(quitKeys),
                new ConsoleRenderer(xdim, ydim, new ConsolePixel(' ')),
                new CollisionHandler(xdim, ydim));

            // Create walls
            GameObject   walls     = new GameObject("Walls");
            ConsolePixel wallPixel = new ConsolePixel(
                ' ', ConsoleColor.Blue, ConsoleColor.DarkGray);
            Dictionary <Vector2, ConsolePixel> wallPixels =
                new Dictionary <Vector2, ConsolePixel>();

            for (int x = 0; x < xdim; x++)
            {
                // Ground and walls
                if ((x > 0 && x < 25) ||
                    (x > 30 && x < 127) ||
                    (x > 135 && x < xdim))
                {
                    wallPixels[new Vector2(x, ydim - 1)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 1));
                    wallPixels[new Vector2(x, ydim - 2)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 2));
                    wallPixels[new Vector2(x, ydim - 3)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 3));
                    wallPixels[new Vector2(x, ydim - 4)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 4));
                    wallPixels[new Vector2(x, ydim - 5)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 5));
                    wallPixels[new Vector2(x, ydim - 6)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 6));
                    wallPixels[new Vector2(x, ydim - 7)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 7));
                }

                // Platform
                if (x > 30 && x < 45)
                {
                    wallPixels[new Vector2(x, ydim - 18)] = wallPixel;
                    occupied.Add(new Vector2(x, ydim - 18));
                }
            }

            for (int y = 0; y < ydim; y++)
            {
                wallPixels[new Vector2(0, y)] = wallPixel;
                occupied.Add(new Vector2(0, y));
                wallPixels[new Vector2(xdim - 1, y)] = wallPixel;
                occupied.Add(new Vector2(xdim - 1, y));
            }

            // Create obstacles
            GameObject   obstacle      = new GameObject("Obstacle");
            ConsolePixel obstaclePixel = new ConsolePixel(
                ' ', ConsoleColor.Blue, ConsoleColor.Green);
            Dictionary <Vector2, ConsolePixel> obstaclePixels =
                new Dictionary <Vector2, ConsolePixel>();

            obstaclePixels[new Vector2(49, 19)] = obstaclePixel;
            occupied.Add(new Vector2(49, 19));

            obstaclePixels[new Vector2(52, 19)] = obstaclePixel;
            occupied.Add(new Vector2(52, 19));

            obstaclePixels[new Vector2(50, 20)] = obstaclePixel;
            occupied.Add(new Vector2(50, 20));

            obstaclePixels[new Vector2(50, 21)] = obstaclePixel;
            occupied.Add(new Vector2(50, 21));

            obstaclePixels[new Vector2(50, 19)] = obstaclePixel;
            occupied.Add(new Vector2(50, 19));

            obstaclePixels[new Vector2(50, 22)] = obstaclePixel;
            occupied.Add(new Vector2(50, 22));

            obstaclePixels[new Vector2(51, 20)] = obstaclePixel;
            occupied.Add(new Vector2(51, 20));

            obstaclePixels[new Vector2(51, 21)] = obstaclePixel;
            occupied.Add(new Vector2(51, 21));

            obstaclePixels[new Vector2(51, 19)] = obstaclePixel;
            occupied.Add(new Vector2(51, 19));

            obstaclePixels[new Vector2(51, 22)] = obstaclePixel;
            occupied.Add(new Vector2(51, 22));

            walls.AddComponent(new ConsoleSprite(wallPixels));
            walls.AddComponent(new Position(0, 0, 1));
            gameScene.AddGameObject(walls);

            obstacle.AddComponent(new ConsoleSprite(obstaclePixels));
            obstacle.AddComponent(new Position(0, 0, 0));
            gameScene.AddGameObject(obstacle);

            // Create game object for showing score
            GameObject score = new GameObject("Score");

            score.AddComponent(new Position(1, 0, 10));
            score.AddComponent(new Score());
            RenderableStringComponent visualScore = new RenderableStringComponent(
                () => "Score: " + 3000.ToString(),
                i => new Vector2(i, 0),
                ConsoleColor.DarkMagenta,
                ConsoleColor.White);

            score.AddComponent(visualScore);
            gameScene.AddGameObject(score);

            // Create Coin Sprite
            char[,] coinSprite =
            {
                { '█' },
            };

            // Coin 1
            GameObject coin1 = new GameObject("Coin1");

            coin1.AddComponent(new ConsoleSprite(coinSprite));
            coin1.AddComponent(new Position(80, 19, 0f));
            coin1.AddComponent(new CoinConfirmation());
            gameScene.AddGameObject(coin1);
            coins.Add(coin1);

            // Coin 2
            GameObject coin2 = new GameObject("Coin2");

            coin2.AddComponent(new ConsoleSprite(coinSprite));
            coin2.AddComponent(new Position(35, 8, 0f));
            coin2.AddComponent(new CoinConfirmation());
            gameScene.AddGameObject(coin2);
            coins.Add(coin2);

            // Box sprite
            char[,] boxSprite =
            {
                { '█', '█', '█', '█' },
                { '█', '?', '?', '█' },
                { '█', '?', '?', '█' },
                { '█', '?', '?', '█' },
                { '█', '?', '?', '█' },
                { '█', '█', '█', '█' },
            };

            // Create Box1
            GameObject box = new GameObject("Box");

            box.AddComponent(new ConsoleSprite(
                                 boxSprite,
                                 ConsoleColor.Yellow,
                                 ConsoleColor.DarkGray));
            box.AddComponent(new Position(100, 8, 0f));
            box.AddComponent(new BoxConfirmation());
            gameScene.AddGameObject(box);
            boxes.Add(box);

            // Create Box2
            GameObject box2 = new GameObject("Box2");

            box2.AddComponent(new ConsoleSprite(
                                  boxSprite,
                                  ConsoleColor.Yellow,
                                  ConsoleColor.DarkGray));
            box2.AddComponent(new Position(150, 8, 0f));
            box2.AddComponent(new BoxConfirmation());
            gameScene.AddGameObject(box2);
            boxes.Add(box2);

            // Create dead text
            GameObject dead = new GameObject("Dead");

            dead.AddComponent(new Position(70, 10, 10));
            RenderableStringComponent deadString = new RenderableStringComponent(
                () => string.Empty,
                i => new Vector2(i, 0),
                ConsoleColor.Red,
                ConsoleColor.Gray);

            dead.AddComponent(deadString);
            gameScene.AddGameObject(dead);

            // Create player object
            // ─▄████▄▄
            // ▄▀█▀▐└─┐
            // █▄▐▌▄█▄┘
            // └▄▄▄▄▄┘
            char[,] playerSprite =
            {
                { '─', '▄', '█', '└' },
                { '▄', '▀', '▄', '▄' },
                { '█', '█', '▐', '▄' },
                { '█', '▀', '▐', '▄' },
                { '█', '▐', '▄', '▄' },
                { '█', '└', '█', '▄' },
                { '▄', '─', '▄', '┘' },
                { '▄', '┐', '┘', ' ' },
            };

            // Create player
            GameObject  player            = new GameObject("Player");
            KeyObserver playerKeyListener = new KeyObserver(
                new ConsoleKey[] {
                ConsoleKey.RightArrow,
                ConsoleKey.Spacebar,
                ConsoleKey.UpArrow,
                ConsoleKey.LeftArrow,
                ConsoleKey.Escape,
            });

            player.AddComponent(playerKeyListener);
            Position playerPos = new Position(1f, 19f, 0f);

            player.AddComponent(playerPos);
            player.AddComponent(new Player(
                                    occupied,
                                    score.GetComponent <Score>(),
                                    boxes,
                                    coins,
                                    dead,
                                    1));
            player.AddComponent(new ConsoleSprite(
                                    playerSprite, ConsoleColor.Red, ConsoleColor.Gray));
            gameScene.AddGameObject(player);

            // Create game object for showing time limit
            GameObject time = new GameObject("Time");

            time.AddComponent(new Position(190, 0, 10));
            time.AddComponent(new Time());
            RenderableStringComponent visualTime = new RenderableStringComponent(
                () => "Time: " + 200.ToString(),
                i => new Vector2(i, 0),
                ConsoleColor.DarkMagenta,
                ConsoleColor.White);

            time.AddComponent(visualTime);
            gameScene.AddGameObject(time);
        }
    public void RenderGame()
    {
        char symbol = ' ';
        offset = new Vector2((int)data.player.position.x - (viewH / 2), (int)data.player.position.y - (viewW / 2));

        //Console.Clear();
        ConsoleColor f = ConsoleColor.Gray;
        ConsoleColor b = ConsoleColor.Black;

        for (int i = 0; i < uiContent.GetLength(0); i++)
        {
            for (int j = 0; j < uiContent.GetLength(1); j++)
            {
                uiContent[i, j] = new ConsolePixel();
            }
        }

        //Player Health stuff
        for (int i = 0; i < data.player.maxHealth; i++)
        {

            if (i < data.player.health)
                f = ConsoleColor.Red;
            else
                f = ConsoleColor.DarkGray;

            uiContent[1, 0 + i] = new ConsolePixel('♥', f, b);
        }
        f = ConsoleColor.Gray;
        b = ConsoleColor.Black;
        /**/

        //Player Actions stuff
        int debug = data.player.maxActions;  // player.maxActions
        int debug2 = data.player.actions; // player.Actions
        for (int i = 0; i < debug; i++)
        {
            if (i < debug2)
                f = ConsoleColor.White;
            else
                f = ConsoleColor.DarkGray;

            uiContent[1, data.player.maxHealth + 1 + i] = new ConsolePixel('>', f, b);
        }
        f = ConsoleColor.Gray;
        b = ConsoleColor.Black;
        /**/

        //Score stuff
        if (true)
        {
            string content = data.score.GetScore().ToString();
            char[] label = content.ToCharArray();

            for (int i = 0; i < label.Length; i++)
            {
                f = ConsoleColor.White;
                uiContent[1, viewW - content.Length + i] = new ConsolePixel(label[i], f, b);
            }
        }
        f = ConsoleColor.Gray;
        b = ConsoleColor.Black;
        /**/
        //Ammo Stuff
        if (data.player.Weapon.content.currentammo > -1 && data.player.Weapon.content.ammo > -1)
        {
            string content = data.player.Weapon.content.currentammo.ToString() + "/" + data.player.Weapon.content.ammo;
            char[] label = content.ToCharArray();

            for (int i = 0; i < label.Length; i++)
            {
                if (data.player.Weapon.content.currentammo == 0 && label[i].ToString().Equals("0"))
                {
                    f = ConsoleColor.Red;
                }
                else f = ConsoleColor.Gray;
                uiContent[1, viewW - content.Length + i] = new ConsolePixel(label[i], f, b);
            }
        }
        else
        {
            string content = "melee";
            char[] label = content.ToCharArray();

            for (int i = 0; i < label.Length; i++)
            {
                uiContent[1, viewW - content.Length + i] = new ConsolePixel(label[i], f, b);
            }
        }

        //Geography Render
        for (int i = 0; i < viewH; i++)
        {
            for (int j = 0; j < viewW; j++)
            {
                //Todo: Dont render whole level
                //
                //REALLY SIMPLE METHOD, CAN PROBABLY DO BETTER
                /*
                if (Vector2.Distance(new Vector2(i, j), data.player.position) > 5)
                    continue;
                    */

                int x = (int)offset.x + i;
                int y = (int)offset.y + j;

                if ((x >= 0 && x < data.level.structure.GetLength(0)) && (y >= 0 && y < data.level.structure.GetLength(1)))
                {
                    symbol = TILE_CHARS[data.level.structure[x, y].terrain];
                    //?+i/?+j for the level position offset
                    f = ConsoleColor.Gray;
                    b = ConsoleColor.Black;
                    uiContent[i + (int)loff.x, j] = new ConsolePixel(symbol, f, b);
                }
                /*
                else
                {
                    f = ConsoleColor.Black;
                    b = ConsoleColor.DarkGreen;
                    uiContent[i + (int)loff.x, j] = new ConsolePixel(' ', f, b);
                }
                /**/
            }
Example #19
0
        /// <summary>
        /// Method responsible for creating every gameobject.
        /// </summary>
        private void CreateGameObjects()
        {
            keyReader.QuitKeys.Add(ConsoleKey.Enter);
            sceneChanger = new GameObject("Scene Changer");
            SceneChangerComponent sceneChangerComponent =
                new SceneChangerComponent(sceneHandler);

            sceneChanger.AddComponent(sceneChangerComponent);
            sceneChangerComponent.SceneToLoad = "LevelScene";

            ////////////////////////////////////////////////////////////////////

            newLevelCreator = new GameObject("New Level Creator");

            CreateNewLevelComponent createLevel =
                new CreateNewLevelComponent(keyReader, sceneHandler, random);

            newLevelCreator.AddComponent(createLevel);

            ////////////////////////////////////////////////////////////////////

            pacmanLogo = new GameObject("Pacman Logo");
            ConsolePixel logoPixel = new ConsolePixel(
                ' ', ConsoleColor.White, ConsoleColor.DarkYellow);

            Dictionary <Vector2Int, ConsolePixel> logoPixels =
                new Dictionary <Vector2Int, ConsolePixel>();

            ICollection <Vector2Int[]> positionsList = new List <Vector2Int[]>();

            CreatePacmanSprite(positionsList);

            foreach (Vector2Int[] v in positionsList)
            {
                for (int i = v[0].X; i < v[1].X + 1; i++)
                {
                    for (int j = v[0].Y; j < v[1].Y + 1; j++)
                    {
                        logoPixels[new Vector2Int(i, j)] = logoPixel;
                    }
                }
            }

            pacmanLogo.AddComponent(new TransformComponent(20, 1));
            pacmanLogo.AddComponent(new ConsoleSprite(logoPixels));

            ////////////////////////////////////////////////////////////////////

            selector = new GameObject("Selector");
            char[,] selectorSprite = { { '-' }, { '-' }, { '>' }, };

            MapComponent  map = new MapComponent(XSIZE, YSIZE);
            MoveComponent selectorMovement = new MoveComponent();

            selector.AddComponent(keyReader);
            selector.AddComponent(new TransformComponent(2, 34));
            selector.AddComponent(selectorMovement);
            selector.AddComponent(map);
            selector.AddComponent(new ConsoleSprite(
                                      selectorSprite,
                                      ConsoleColor.White,
                                      ConsoleColor.DarkBlue));
            SelectorMovementBehaviour selectorMovementBehaviour =
                new SelectorMovementBehaviour(
                    selector,
                    sceneChanger.
                    GetComponent <SceneChangerComponent>());

            // Adds a movement behaviour
            selectorMovement.AddMovementBehaviour(selectorMovementBehaviour);

            ////////////////////////////////////////////////////////////////////

            startText = new GameObject("Start Game");
            startText.AddComponent(new TransformComponent(6, 34));

            RenderableStringComponent renderStartGame
                = new RenderableStringComponent(
                      () => "START GAME",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.Yellow,
                      ConsoleColor.DarkBlue);

            startText.AddComponent(renderStartGame);

            ////////////////////////////////////////////////////////////////////

            quitText = new GameObject("Quit");
            quitText.AddComponent(new TransformComponent(6, 36));

            RenderableStringComponent renderQuit
                = new RenderableStringComponent(
                      () => "QUIT",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            quitText.AddComponent(renderQuit);

            ////////////////////////////////////////////////////////////////////

            highScoreText = new GameObject("HighScore Text");

            highScoreText.AddComponent(new TransformComponent(6, 28));

            RenderableStringComponent renderHighScoreText
                = new RenderableStringComponent(
                      () => $"HighScore:",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            highScoreText.AddComponent(renderHighScoreText);

            ////////////////////////////////////////////////////////////////////

            highScoreNumberText = new GameObject("HighScore Number Text");

            HighScoreComponent highScoreComponent =
                new HighScoreComponent();

            RenderableStringComponent renderHighScoreNumberText
                = new RenderableStringComponent(
                      () => $"{highScoreComponent.HighScore}",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            highScoreNumberText.AddComponent(new TransformComponent(6, 30));
            highScoreNumberText.AddComponent(renderHighScoreNumberText);
            highScoreNumberText.AddComponent(highScoreComponent);

            ////////////////////////////////////////////////////////////////////

            controlsText = new GameObject("ControlsText");
            controlsText.AddComponent(new TransformComponent(70, 19));

            RenderableStringComponent renderControls
                = new RenderableStringComponent(
                      () => "Controls:",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            controlsText.AddComponent(renderControls);

            ////////////////////////////////////////////////////////////////////

            movementText = new GameObject("MovementText");
            movementText.AddComponent(new TransformComponent(54, 21));

            RenderableStringComponent renderMovement
                = new RenderableStringComponent(
                      () => "Movement Keys: W, A, S, D",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            movementText.AddComponent(renderMovement);

            ////////////////////////////////////////////////////////////////////

            actionsText = new GameObject("ActionsText");
            actionsText.AddComponent(new TransformComponent(50, 22));

            RenderableStringComponent renderActions
                = new RenderableStringComponent(
                      () => "Confirm: Enter , Quit: Escape",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            actionsText.AddComponent(renderActions);

            ////////////////////////////////////////////////////////////////////

            rules = new GameObject("RulesText");
            rules.AddComponent(new TransformComponent(73, 24));

            RenderableStringComponent renderRules
                = new RenderableStringComponent(
                      () => "Rules:",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            rules.AddComponent(renderRules);

            ////////////////////////////////////////////////////////////////////

            rule1 = new GameObject("Rule1");
            rule1.AddComponent(new TransformComponent(52, 26));

            RenderableStringComponent renderRule1
                = new RenderableStringComponent(
                      () => "Pacman must run from ghosts",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            rule1.AddComponent(renderRule1);

            ////////////////////////////////////////////////////////////////////

            rule2 = new GameObject("Rule2");
            rule2.AddComponent(new TransformComponent(33, 27));

            RenderableStringComponent renderRule2
                = new RenderableStringComponent(
                      () => "Pacman can pick power pills and eat the ghosts",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            rule2.AddComponent(renderRule2);

            ////////////////////////////////////////////////////////////////////

            rule3 = new GameObject("Rule3");
            rule3.AddComponent(new TransformComponent(37, 28));

            RenderableStringComponent renderRule3
                = new RenderableStringComponent(
                      () => "Pacman must eat every food to end the game",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            rule3.AddComponent(renderRule3);

            ////////////////////////////////////////////////////////////////////

            icons = new GameObject("Icons");
            icons.AddComponent(new TransformComponent(73, 30));

            RenderableStringComponent renderIcons
                = new RenderableStringComponent(
                      () => "Icons:",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            icons.AddComponent(renderIcons);

            ////////////////////////////////////////////////////////////////////

            icon1 = new GameObject("Icon1");
            icon1.AddComponent(new TransformComponent(68, 32));

            RenderableStringComponent renderIcon1
                = new RenderableStringComponent(
                      () => "P -> Pacman",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            icon1.AddComponent(renderIcon1);

            ////////////////////////////////////////////////////////////////////

            icon2 = new GameObject("Icon2");
            icon2.AddComponent(new TransformComponent(54, 33));

            RenderableStringComponent renderIcon2
                = new RenderableStringComponent(
                      () => "Colored Squares -> Ghosts",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            icon2.AddComponent(renderIcon2);

            ////////////////////////////////////////////////////////////////////

            icon3 = new GameObject("Icon3");
            icon3.AddComponent(new TransformComponent(68, 34));

            RenderableStringComponent renderIcon3
                = new RenderableStringComponent(
                      () => "F -> Fruits",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            icon3.AddComponent(renderIcon3);

            ////////////////////////////////////////////////////////////////////

            icon4 = new GameObject("Icon4");
            icon4.AddComponent(new TransformComponent(62, 35));

            RenderableStringComponent renderIcon4
                = new RenderableStringComponent(
                      () => "PUP -> Power Pill",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            icon4.AddComponent(renderIcon4);

            ////////////////////////////////////////////////////////////////////

            icon5 = new GameObject("Icon5");
            icon5.AddComponent(new TransformComponent(70, 36));

            RenderableStringComponent renderIcon5
                = new RenderableStringComponent(
                      () => ". -> Food",
                      i => new Vector2Int(i, 0),
                      ConsoleColor.White,
                      ConsoleColor.DarkBlue);

            icon5.AddComponent(renderIcon5);
        }
 public void Render(ConsolePixel view)
 {
     throw new NotImplementedException();
 }
    public void RenderFinishScreen()
    {
        ConsoleColor f = ConsoleColor.Gray;
        ConsoleColor b = ConsoleColor.Black;

        char[] label;
        string content;

        for (int i = 0; i < uiContent.GetLength(0); i++)
        {
            for (int j = 0; j < uiContent.GetLength(1); j++)
            {
                uiContent[i, j] = new ConsolePixel();
            }
        }

        content = "GAME OVER : SCORE REACHED " + data.score.GetScore().ToString();
        label = content.ToCharArray();
        for (int i = 0; i < label.Length; i++)
        {
            f = ConsoleColor.White;
            uiContent[0, i] = new ConsolePixel(label[i], f);
        }

        //Process all end game information here - I'M VERY SORRY, I KNOW ITS NOT 100% MODEL-VIEW-CONTROL

        content = "PRESS ANY KEY TO RETURN TO MAIN MENU";
        label = content.ToCharArray();
        for (int i = 0; i < label.Length; i++)
        {
            f = ConsoleColor.Green;
            uiContent[1, i] = new ConsolePixel(label[i], f);
        }

        Console.ReadKey();
        Application.ChangeGameState(GameStates.MENU);
    }