我試圖做一些類似於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