public GameControl()
        {
            SpecimanNames = new Dictionary <int, string> ();
            //random names for specimans
            SpecimanNames.Add(0, "Chris");
            SpecimanNames.Add(1, "Tien");
            SpecimanNames.Add(2, "Jai");
            SpecimanNames.Add(3, "Ian");
            SpecimanNames.Add(4, "Lachlan");
            SpecimanNames.Add(5, "Josh");
            SpecimanNames.Add(6, "Cliff");
            SpecimanNames.Add(7, "Andrew");
            SpecimanNames.Add(8, "Luke");
            SpecimanNames.Add(9, "George");
            SpecimanNames.Add(10, "THE ALMIGHTY SPECIMAN!");

            DrillNames = new Dictionary <int, string> ();
            //random names for drills
            DrillNames.Add(0, "Jabber");
            DrillNames.Add(1, "Stabber");
            DrillNames.Add(2, "Poker");
            DrillNames.Add(3, "Nudger");
            DrillNames.Add(4, "Pusher");
            DrillNames.Add(5, "Puncher");

            SearchedArea = new List <Point2D>();

            _width         = 20;
            _height        = 20;
            _textAreaWidth = 600;
            _textBox       = new TextBox(_width * 32, _textAreaWidth);
            _rovers        = new List <Rover> ();
            Random rnd = new Random();

            _rovers.Add(CreateEquipedRover(rnd.Next(1, 5), rnd.Next(1, 5)));
            _rovers.Add(CreateEquipedRover(_width - rnd.Next(1, 5), _height - rnd.Next(1, 5)));
            _Specimans = new List <Speciman> ();
            for (int i = 0; i < 10; i++)
            {
                bool    pointTaken = true;
                Point2D newPoint   = new Point2D();
                while (pointTaken)
                {
                    newPoint   = GameMain.newPoint2D(rnd.Next(0, _width), rnd.Next(0, _height));
                    pointTaken = false;
                    foreach (Speciman S in _Specimans)
                    {
                        if (S.Location.Equals(newPoint))
                        {
                            pointTaken = true;
                            break;
                        }
                    }
                }
                _Specimans.Add(new Speciman(newPoint.X, newPoint.Y, SpecimanNames[i], rnd.Next(1, 20)));
            }
        }
示例#2
0
        public void DrillDown()
        {
            if (_wear > 100)
            {
                Random rnd = new Random();
                if (rnd.Next(1, 5) == 1)
                {
                    return;
                }
            }
            Speciman search = PGC.TakeSpecimanAt(GameMain.newPoint2D(Prover.Location.X, Prover.Location.Y));

            if (search != null)
            {
                Prover.AddSpeciman(search);
                _wear += 5;
            }
            else
            {
                _wear += 10;
            }
        }
示例#3
0
        private void Search()
        {
            bool BeyondFive = false;
            int  lowestx    = (int)Prover.Location.X;
            int  lowesty    = (int)Prover.Location.Y;
            int  highestx   = lowestx;
            int  highesty   = lowesty;
            int  currentx   = lowestx;
            int  currenty   = lowesty;

            PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(currentx, currenty));
            while (!BeyondFive)
            {
                BeyondFive = true;

                //ERROR. CODE BELOW DOESN'T WORK PROPERLY
                //right
                highestx++;
                for (int i = currentx; i < highestx; i++)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(currentx, currenty));
                    }
                    currentx = i + 1;
                }
                //up
                highesty++;
                for (int i = currenty; i < highesty; i++)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(currentx, i));
                    }
                    currenty = i + 1;
                }
                //left
                lowestx--;
                for (int i = currentx; i > lowestx; i--)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(i, currenty));
                    }
                    currentx = i - 1;
                }
                //down
                lowesty--;
                for (int i = currenty; i > lowesty; i--)
                {
                    if (GameMain.DistanceBetweenPoints(currentx, currenty, Prover.Location) <= 5f)
                    {
                        BeyondFive = false;
                        PGC.ProbeForSpeciman(_myType, GameMain.newPoint2D(i, currenty));
                    }
                    currenty = i - 1;
                }
            }
        }