Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Basic_Task22
- {
- class Program
- {
- static void Main(string[] args)
- {
- Player player = new Player("Первый", 5, 2);
- Drawer.DrawPlayer(player);
- }
- }
- class Player
- {
- public string Name { get; set; }
- private int _x;
- public int X
- {
- get
- {
- return _x;
- }
- set
- {
- if (value > 0)
- {
- _x = value;
- } else
- {
- _x = 0;
- }
- }
- }
- private int _y;
- public int Y
- {
- get
- {
- return _y;
- }
- set
- {
- if (value > 0)
- {
- _y = value;
- }
- else
- {
- _y = 0;
- }
- }
- }
- public Player(string name, int x, int y)
- {
- Name = name;
- X = x;
- Y = y;
- }
- }
- class Drawer
- {
- public static void DrawPlayer(Player player, char symbol = '@')
- {
- Console.SetCursorPosition(player.X, player.Y);
- Console.Write(symbol);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement