+ added properties instead of class variables
x removed Typliste (integrated in Einwohner)
This commit is contained in:
+16
-13
@@ -3,31 +3,34 @@ using System.Collections;
|
||||
|
||||
namespace vampi
|
||||
{
|
||||
public abstract class Spielfigur {
|
||||
public abstract class Spielfigur {
|
||||
public const int F_TYPE = 0;
|
||||
public const int TYPE_HUMAN = 1;
|
||||
public const int TYPE_VAMPIRE = 2;
|
||||
|
||||
public const int F_AGE = 1;
|
||||
public const int F_MAXAGE = 2;
|
||||
public int[] props = new int[20];
|
||||
|
||||
protected Spielfeld sfeld;
|
||||
protected int typ;
|
||||
protected int maxAge = 80;
|
||||
protected int age = -1;
|
||||
|
||||
public int Age {
|
||||
get { return this.age; }
|
||||
get { return this.props[F_AGE]; }
|
||||
}
|
||||
|
||||
public int Typ {
|
||||
get { return this.typ; }
|
||||
get { return this.props[F_TYPE]; }
|
||||
}
|
||||
|
||||
public Spielfigur(Spielfeld sfeld) {
|
||||
public Spielfigur(Spielfeld sfeld) {
|
||||
sfeld.Sfigur = this;
|
||||
this.sfeld = sfeld;
|
||||
this.sfeld = sfeld;
|
||||
}
|
||||
|
||||
public virtual void runStep() {
|
||||
if (this.age != -1) {
|
||||
this.age++;
|
||||
if (this.age >= this.maxAge) {
|
||||
this.die();
|
||||
}
|
||||
this.props[F_AGE]++;
|
||||
if (this.props[F_AGE] >= this.props[F_MAXAGE]) {
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user