Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() != typeof(Infection))
            {
                return(false);
            }

            Infection casted = (Infection)obj;

            return
                (this.aggression == casted.aggression &&
                 this.size == casted.size &&
                 this.storeSize == casted.storeSize &&
                 this.spreadArea == casted.spreadArea &&
                 this.spreadDistance == casted.spreadDistance &&
                 this.spreadSpeed == casted.spreadSpeed &&
                 this.strengthPref == casted.strengthPref);
        }
Esempio n. 2
0
 public InfectionSpeciman(Infection type)
 {
     this.type = type;
 }
Esempio n. 3
0
 public static int ofStore(Infection inf)
 {
     return(inf.StoreSize);
 }
Esempio n. 4
0
 public static int ofSpread(Infection inf, double distance)
 {
     // return inf.Size;
     return(inf.Size * 2 + (int)Math.Ceiling(inf.Size * 0.5 * distance));
 }
Esempio n. 5
0
 public InfectionSpeciman(Infection type)
 {
     this.type = type;
 }
Esempio n. 6
0
 public static int ofStore(Infection inf)
 {
     return inf.StoreSize;
 }
Esempio n. 7
0
 public static int ofSpread(Infection inf, double distance)
 {
     // return inf.Size;
       return inf.Size * 2 + (int)Math.Ceiling(inf.Size * 0.5 * distance);
 }
Esempio n. 8
0
 public static int ofSize(Infection inf)
 {
     return inf.Size;
 }
Esempio n. 9
0
        private void initInfections()
        {
            Random rand = new Random();

              Infection inf1 = new Infection()
              {
            Size = 5,
            StoreSize = 2,
            Aggression = 12,
            SpreadSpeed = 3,
            SpreadDistance = 1,
            SpreadArea = 1,
            StrengthPref = 0.75f
              };
              InfectionSpeciman s1 = new InfectionSpeciman(inf1);
              this.infections.Add(inf1, Color.Red);
              Victim v = field.Data[rand.Next(0, SIZE_X), rand.Next(0, SIZE_Y)];
              //v.Health = Field.MAX_HEALTH;
              v.Infect(s1);

              Infection inf2 = new Infection()
              {
            Size = 1,
            StoreSize = 4,
            Aggression = 9,
            SpreadSpeed = 5,
            SpreadDistance = 2,
            SpreadArea = 2,
            StrengthPref = 0.75f
              };
              this.infections.Add(inf2, Color.Green);
              InfectionSpeciman s2 = new InfectionSpeciman(inf2);
              field.Data[rand.Next(0, SIZE_X), rand.Next(0, SIZE_Y)].Infect(s2);

              field.FieldProgressEvent += field_FieldProgressEvent;

              Infection inf3 = new Infection()
              {
            Size = 1,
            StoreSize = 2,
            Aggression = 5,
            SpreadSpeed = 5,
            SpreadDistance = 1,
            SpreadArea = 1,
            StrengthPref = 0.75f
              };
              this.infections.Add(inf3, Color.DarkOrange);
              InfectionSpeciman s3 = new InfectionSpeciman(inf3);
              field.Data[rand.Next(0, SIZE_X), rand.Next(0, SIZE_Y)].Infect(s3);
        }