Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members

CellInfect.cs

Go to the documentation of this file.
00001 /*
00002 SimImmuno version 1.0
00003 Copyright (C) 2005 sebeuh.ajsinfo.net
00004 
00005 SimImmuno est libre, vous pouvez le redistribuer et/ou le modifier
00006 selon les termes de la Licence Publique Générale GNU publiée par la
00007 Free Software Foundation (version 2).
00008 
00009 SimImmuno est distribué car potentiellement utile, mais SANS AUCUNE GARANTIE,
00010 ni explicite ni implicite, y compris les garanties de commercialisation
00011 ou d'adaptation dans un but spécifique. Reportez-vous à la
00012 Licence Publique Générale GNU pour plus de détails.
00013 
00014 Texte de la license officielle (anglais) :
00015 http://simimmuno.ajsinfo.net/text.aspx?code=no&txt_file=GPL.txt
00016 Traduction francaise (non-officielle) :
00017 http://simimmuno.ajsinfo.net/text.aspx?code=no&txt_file=GPL-fr.txt
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 }

Generated on Sat Jun 4 15:03:41 2005 for SimImmuno by  doxygen 1.4.2