Exemplo n.º 1
0
 public Fungus(Point initPos, CDrawer dr, FungusColor color)
 {
     pos       = initPos;
     growColor = color;
     lock (visitedPoints)
     {
         visitedPoints.Add(initPos, (int)color);
     }
     fungusThread = new Thread(GrowFungus);
     fungusThread.IsBackground = true;
     fungusThread.Start(dr);
 }
        }                                    //Drawer

        //******************************************************
        //Constructor Method: Take user specified position, drawer, and color; initialize the class.
        //******************************************************
        public Fungus(Point start, CDrawer drawer, FungusColor color)
        {
            _grid   = new Dictionary <Point, int>();
            _cPoint = start;
            _drawer = drawer;
            _color  = color;
            Thread nThread = new Thread(ThreadMethod);

            //Set Thread in background and start
            _thread = nThread;
            _thread.IsBackground = true;
            _thread.Start();
        }