Exemplo n.º 1
0
        public Game(Int32 fieldw, Int32 fieldh, String dll1="", String dll2="", String dll3="")
        {
            Robots = new List<IRobot>();
            Bullets = new List<IBullet>();
            field = new Field(fieldw, fieldw);
            Random rand = new Random();

            str = "";
            Assembly AI1 = Assembly.LoadFrom(@dll1);
            Assembly AI2 = Assembly.LoadFrom(@dll2);
            Robots.Add((IRobot)AI1.CreateInstance("Robot.Robot"));
            Robots.Add((IRobot)AI2.CreateInstance("Robot.Robot"));
            FireToHandler d1 = new FireToHandler(OnFireToHandler);
            Robots[0].Build();
            Robots[0].FireEvent += d1;
            Robots[1].Build();
            Robots[1].FireEvent += d1;

            /*
            Robots.Add(new Robot(dll1, new Vector((float)rand.Next(20, 580), (float)rand.Next(20, 580))));
            Robots.Add(new Robot(dll2, new Vector((float)rand.Next(20, 580), (float)rand.Next(20, 580))));
            Robots.Add(new Robot(dll3, new Vector((float)rand.Next(20, 580), (float)rand.Next(20, 580))));
            */
            field = new Field(fieldw, fieldh);
            Bmp = new Bitmap(Field.width, Field.height);
            graph = Graphics.FromImage(Bmp);
            Draw();
        }
Exemplo n.º 2
0
        public Game(String dll1, String dll2, String dll3, Int32 fieldw, Int32 fieldh)
        {
            Random rand = new Random();

            Robots.Add(new Robot(dll1, new Vector((float)rand.Next(), (float)rand.Next())));
            Robots.Add(new Robot(dll2, new Vector((float)rand.Next(), (float)rand.Next())));
            Robots.Add(new Robot(dll3, new Vector((float)rand.Next(), (float)rand.Next())));

            field = new Field(fieldw, fieldh);
            Bmp = new Bitmap(field.width, field.height);
            graph = Graphics.FromImage(Bmp);
        }