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

Antigen.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 Antigen : Cellule
00025         {
00026                 public Antigen(int x, int y) : base(x,y)
00027                 {
00028                         Life = 10000;
00029                         specificite = rnd.Next(4);
00030                 }
00031 
00032                 public Antigen(int x, int y, int spe) : base(x,y)
00033                 {
00034                         Life = 10000;
00035                         specificite = spe;
00036                 }
00037 
00038                 public Antigen(int x, int y, int spe, int life) : base(x,y)
00039                 {
00040                         Life = life;
00041                         specificite = spe;
00042                 }
00043 
00044                 new public void Action()
00045                 {
00046                         Mouvement();
00047                         ccol_copy = (CellulesCollection)frmMain.ccol.Clone();
00048                         int tmp = 0;
00049                         foreach(Cellule cell in ccol_copy)
00050                         {
00051                                 double dst = DistTo(cell,this);
00052                                 if(dst < 200)
00053                                 {
00054                                         if(tmp == 0 && !(cell is Antigen) && !(cell is LB) && !(cell is CellInfect) && !(cell is Anticorp) && !(cell is CI) && !(cell is Debris) && !(cell is InfectVIH) && !(cell is LT4) && !(cell is LT4m) && !(cell is LT8) && !(cell is LT8m) && !(cell is LTc) && !(cell is Phagocyte) && !(cell is Plasmocyte) && !(cell is VIH))
00055                                         {
00056                                                 Infection(cell);
00057                                                 frmMain.log.NewEvent("Infection de la cellule n°" + cell.index.ToString() + " (spé:" + specificite.ToString() +")");
00058                                                 tmp++;
00059                                         }
00060                                 }
00061                         }
00062                         return;
00063                 }
00064 
00065                 private void Infection(Cellule cell)
00066                 {
00067                         int x = cell.Location.X;
00068                         int y = cell.Location.Y;
00069                         frmMain.ccol.RemoveAt(cell.index);
00070                         CellInfect icell = new CellInfect(x,y,specificite);
00071                         frmMain.ccol.Add(icell);
00072                 }
00073 
00074                 private void Mouvement()
00075                 {
00076                         int tmp = rnd.Next(2);
00077                         int x,y;
00078                         if(tmp == 0)
00079                         {
00080                                 x = this.Location.X + rnd.Next(-5,5);
00081                                 y = this.Location.Y + rnd.Next(-5,5);
00082                         }
00083                         else
00084                         {
00085                                 x = this.Location.X - rnd.Next(-5,5);
00086                                 y = this.Location.Y - rnd.Next(-5,5);
00087                         }
00088                         this.Location.X = x;
00089                         this.Location.Y = y;
00090                 }
00091         }
00092 }

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