Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp11
- {
- class Program
- {
- static void Main(string[] args)
- {
- Player player = new Player("Dmitry");
- player.Damage = 101;
- player.Armor = 102;
- player.Health = 100;
- player.Show();
- }
- }
- class Player
- {
- Name name = null;
- Armor armor = null;
- Damage damage = null;
- Health health = null;
- void InitializePlayer()
- {
- this.name = new Name();
- this.health = new Health();
- this.damage = new Damage();
- this.armor = new Armor();
- }
- public Player(string name)
- {
- InitializePlayer();
- this.name.Content = name;
- }
- public void Show()
- {
- this.name.Show();
- this.damage.Show();
- this.armor.Show();
- this.health.Show();
- }
- public int Damage
- {
- set
- {
- this.damage.Content = value;
- }
- }
- public int Health
- {
- set
- {
- this.health.Content = value;
- }
- }
- public int Armor
- {
- set
- {
- this.armor.Content = value;
- }
- }
- }
- class Name
- {
- private string content;
- public string Content
- {
- private get
- {
- if (content != null)
- return content;
- else
- return "Имя отсутствует";
- }
- set
- {
- content = value;
- }
- }
- public void Show()
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine(Content);
- Console.ForegroundColor = ConsoleColor.Gray;
- }
- }
- class Armor
- {
- private int content;
- public int Content
- {
- private get
- {
- return content;
- }
- set
- {
- content = value;
- }
- }
- public void Show()
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.WriteLine($"Бронь={Content}");
- Console.ForegroundColor = ConsoleColor.Gray;
- }
- }
- class Damage
- {
- private int content;
- public int Content
- {
- private get
- {
- return content;
- }
- set
- {
- content = value;
- }
- }
- public void Show()
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine($"Урон={Content}");
- Console.ForegroundColor = ConsoleColor.Gray;
- }
- }
- class Health
- {
- private int content;
- public int Content
- {
- private get
- {
- return content;
- }
- set
- {
- content = value;
- }
- }
- public void Show()
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine($"Здоровье={Content}");
- Console.ForegroundColor = ConsoleColor.Gray;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement