Как правильно построить иерархию классов простой игры?
Я имею такую проблему, что не знаю как сделать верно, моя архитектура на корню не верна, я бы хотел знать как сделать более правильно, что бы при расширении не было проблем.
namespace Game_taskApp
{
class Player : IWalk
{
public string Name { get; set; }
public char simbol;
public int Walk()
{
}
}
interface IWalk
{
abstract int Walk();
}
class Field
{
private int _weight;
private int _height;
private char _border;
public Field(int weight, int height,char border)
{
if (weight < 15 || weight > 50) { weight = 15; }
if (height < 15 || height > 50) { height = 15; }
_weight = weight;
_height = height;
_border = border;
}
public int GetWeightField()
{
return _weight;
}
public int GetHeightField()
{
return _height;
}
public int GetBorder()
{
return _border;
}
}
class Bonus
{
private int _bonus;
public Bonus(int bonus)
{
if(bonus < 0 ||bonus > 15)
{
bonus = 10;
}
_bonus = bonus;
}
public int GetBonus()
{
return _bonus;
}
}
class Enemy : IWalk
{
private int _quantity;
public Enemy(int quantity)
{
if (quantity < 0 || quantity > 10)
{
quantity = 10;
}
_quantity = quantity;
}
public int GetEnemiesCount()
{
return _quantity;
}
public void Walk()
{
}
int IWalk.Walk()
{
throw new NotImplementedException();
}
}
class Wood
{
private int _wood;
public Wood(int wood)
{
if (wood > 10 || wood < 0)
{
wood = 10;
}
_wood = wood;
}
public int GetWood()
{
return _wood;
}
}
}
