public Training(Unit pu, Zone pz) { u = pu; z = pz; int s = (int)u.GetType().GetField("time").GetRawConstantValue(); t = new TimeSpan(0, 0, s); }
public void startTraining(Unit pu) { map.training.Add(new Training(new Warrior(), this)); }
public void recruit(Unit pu) { u.inc(pu); }
public void inc(Unit pu) { string s = pu.GetType().Name.ToLower() + "Nr"; FieldInfo f=this.GetType().GetField(s, BindingFlags.NonPublic | BindingFlags.Instance); if (f == null) throw new Exception("Unit type not found in list !"); f.SetValue(this, (int)f.GetValue(this)+1); }
public void trainUnit(Zone z, Unit u) { if (u == null) throw new Exception("Cannot train that unit(null) !"); z.startTraining(u); }