Пример #1
0
 public Training(Unit pu, Zone pz)
 {
     u = pu;
     z = pz;
     int s = (int)u.GetType().GetField("time").GetRawConstantValue();
     t = new TimeSpan(0, 0, s);
 }
Пример #2
0
        public Training(Unit pu, Zone pz)
        {
            u = pu;
            z = pz;
            int s = (int)u.GetType().GetField("time").GetRawConstantValue();

            t = new TimeSpan(0, 0, s);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }