00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 using System;
00020
00021 namespace SimImmuno
00022 {
00023 [Serializable]
00024 public class CellInfect : Cellule
00025 {
00026 public CellInfect(int x, int y, int spe) : base(x,y)
00027 {
00028 Location = new System.Drawing.Point(x,y);
00029 Life = rnd.Next(MaxLifeTime+1000);
00030 specificite = spe;
00031 }
00032
00033 public CellInfect(int x, int y, int spe, int life) : base(x,y)
00034 {
00035 Location = new System.Drawing.Point(x,y);
00036 Life = life;
00037 specificite = spe;
00038 }
00039
00040 new public void Action()
00041 {
00042 Mouvement();
00043 if(rnd.Next(500)==1)
00044 {
00045 Divide();
00046 }
00047 return;
00048 }
00049
00050 private void Divide()
00051 {
00052 int x = rnd.Next(-5,5);
00053 int y = rnd.Next(-5,5);
00054 CellInfect icell = new CellInfect(Location.X+x,Location.Y+y,specificite);
00055 frmMain.ccol.Add(icell);
00056 }
00057
00058 private void Mouvement()
00059 {
00060 int tmp = rnd.Next(2);
00061 int x,y;
00062 if(tmp == 0)
00063 {
00064 x = this.Location.X + rnd.Next(-5,5);
00065 y = this.Location.Y + rnd.Next(-5,5);
00066 }
00067 else
00068 {
00069 x = this.Location.X - rnd.Next(-5,5);
00070 y = this.Location.Y - rnd.Next(-5,5);
00071 }
00072 this.Location.X = x;
00073 this.Location.Y = y;
00074 }
00075 }
00076 }