nikitaTheSlayer

Lesson: OOP_2

Feb 5th, 2022 (edited)
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Administrirovanie_Kafe
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Renderer renderer = new Renderer();
  10.             Player player = new Player(2, 2);
  11.  
  12.             renderer.DrawPlayer(player.CoordinateX, player.CoordinateY);
  13.         }
  14.     }
  15.  
  16.     class Renderer
  17.     {
  18.         public void DrawPlayer(int coordinateX, int coordinateY, char player = '@')
  19.         {
  20.             Console.SetCursorPosition(coordinateX, coordinateY);
  21.             Console.WriteLine(player);
  22.         }
  23.     }
  24.  
  25.     class Player
  26.     {
  27.         public int CoordinateX { get; private set; }
  28.         public int CoordinateY { get; private set; }
  29.  
  30.         public Player(int playerX, int playerY)
  31.         {
  32.             CoordinateX = playerX;
  33.             CoordinateY = playerY;
  34.         }
  35.     }
  36. }
  37.  
Add Comment
Please, Sign In to add comment