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); }
public InfectionSpeciman(Infection type) { this.type = type; }
public static int ofStore(Infection inf) { return(inf.StoreSize); }
public static int ofSpread(Infection inf, double distance) { // return inf.Size; return(inf.Size * 2 + (int)Math.Ceiling(inf.Size * 0.5 * distance)); }
public static int ofStore(Infection inf) { return inf.StoreSize; }
public static int ofSpread(Infection inf, double distance) { // return inf.Size; return inf.Size * 2 + (int)Math.Ceiling(inf.Size * 0.5 * distance); }
public static int ofSize(Infection inf) { return inf.Size; }
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); }