Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ООП
- {
- class Program
- {
- static void Main(string[] args)
- {
- Renderer renderer = new Renderer();
- Player player1 = new Player(3, 4);
- Player player2 = new Player(5, 2, '&');
- renderer.DrawPlayer(player1.PositionX, player1.PositionY, player1.Symbol);
- renderer.DrawPlayer(player2.PositionX, player2.PositionY, player2.Symbol);
- }
- }
- class Player
- {
- public int PositionX { get; private set; }
- public int PositionY { get; private set; }
- public char Symbol { get; private set; }
- public Player(int positionX, int positionY, char symbol = '@')
- {
- PositionX = positionX;
- PositionY = positionY;
- Symbol = symbol;
- }
- }
- class Renderer
- {
- private int _defauldCursorPositionX = 10;
- private int _defauldCursorPositionY = 10;
- public void DrawPlayer(int positionX, int positionY, char symbol)
- {
- Console.SetCursorPosition(positionX, positionY);
- Console.Write(symbol);
- Console.SetCursorPosition(_defauldCursorPositionX, _defauldCursorPositionY);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement