Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSharpLight_HomeWork___OOP___DrawPlayer
- {
- class Program
- {
- static void Main(string[] args)
- {
- Render render = new Render();
- Player player = new Player(5, 4, 'X');
- player.SetSymbol('Y');
- render.DrawPlayer(player.PositionX, player.PositionY, player.GetSymbol());
- Console.ReadKey();
- }
- }
- class Player
- {
- private char _symbol;
- public int PositionX { get; private set; }
- public int PositionY { get; private set; }
- public Player (int x, int y, char symbol)
- {
- PositionX = x;
- PositionY = y;
- _symbol = symbol;
- }
- public char GetSymbol()
- {
- return _symbol;
- }
- public void SetSymbol(char symbol)
- {
- _symbol = symbol;
- }
- }
- class Render
- {
- public void DrawPlayer(int x, int y, char symbol)
- {
- Console.SetCursorPosition(x, y);
- Console.WriteLine(symbol);
- }
- }
- }
Add Comment
Please, Sign In to add comment