我试图做一些类似于Rpg游戏atm的东西,但我真的停留在一些东西上,我真的不知道该怎么做了,我真的需要帮助它可能看起来像一个noob问题,但请尝试回答我>。 <这是父类Polymorphism麻烦C#
namespace ConsoleApplication1
{
class Personaje
{
public Rango Damage;
public int Defensa;
public int HP;
public int MP;
public bool Evade;
public bool Counter;
public string Nombre;
public Personaje() { }
public Personaje(Rango Damage, int Defensa, int HP, bool Evade, bool Counter, string Nombre)
{
this.Damage = Damage;
this.Defensa = Defensa;
this.HP = HP;
this.Evade = Evade;
this.Counter = Counter;
this.Nombre = Nombre;
}
}
}
这是孩子的
namespace ConsoleApplication1
{
class Enemigo:Personaje
{
}
}
这是孩子的一个和遇到问题一个IM与我不知道如何把它
状态的一个namespace ConsoleApplication1
{
class Poring:Enemigo
{
int HP = 30;
int MP = 10;
int Def = 0;
public bool Evade()
{
return false;
}
public bool Counter()
{
return false;
}
public Rango Damage()
{
Rango r = new Rango();
r.min = 10;
r.max = 15;
return r;
}
string Nombre = "Poring";
//Personaje Propiedades = new Personaje(Damage,Def, HP, Evade, Counter, Nombre);
Personaje omg = new Personaje();
}
}
有一个小窍门,你可能会得到更好的答案,如果你更清楚你遇到困难的 - “我不知道如何把状态”有点不确切。 (我认为这是你的Evade和Counter方法,但是我认为,他可能是对的,你问的是通过构造函数设置这些初始属性值。)我知道初学者很难知道术语,具体如你总是可以帮助! – itowlson 2009-12-12 22:32:21