Пример #1
0
        public Clockworkbeast(GraphicsDeviceManager g, Vector2 pos, Vector2 dir, TownCenter tc)
        {
            graphics   = g;
            position   = pos;
            direction  = dir;
            towncenter = tc;

            pixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            pixel.SetData(new Color[] { Color.LightPink });

            moveBehaviour = new CircleWalk(position, 50);
        }
Пример #2
0
        public Mathbeast(GraphicsDeviceManager g, Vector2 pos, Vector2 dir, TownCenter tc)
        {
            graphics   = g;
            position   = pos;
            direction  = dir;
            towncenter = tc;

            pixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            pixel.SetData(new Color[] { Color.White });

            moveBehaviour = new CosineWalk(position, 100);
        }
Пример #3
0
        public Bishop(GraphicsDeviceManager g, Vector2 pos, Vector2 dir, TownCenter tc)
        {
            graphics   = g;
            position   = pos;
            direction  = dir;
            towncenter = tc;

            pixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            pixel.SetData(new Color[] { Color.Yellow });

            moveBehaviour = new XYWalk();
        }
Пример #4
0
        public Horseman(GraphicsDeviceManager g, Vector2 pos, Vector2 dir, TownCenter tc)
        {
            graphics   = g;
            position   = pos;
            direction  = dir;
            towncenter = tc;

            pixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            pixel.SetData(new Color[] { Color.LightGreen });

            moveBehaviour = new YWalk();
        }
Пример #5
0
        public void LoadContent(GraphicsDeviceManager g, Game ga)
        {
            graphics = g;
            graphics.IsFullScreen = false;
            game = ga;
            Knight         k;
            Horseman       hm;
            Bishop         b;
            Clockworkbeast cwb;
            Mathbeast      mb;
            MadDog         md;

            background = game.Content.Load <Texture2D>("grass.jpg");
            tekst      = game.Content.Load <Texture2D>("tekst.png");

//			game_elements.Add (new Knight (graphics, new Vector2 (0,30), new Vector2(1,1)));
//			game_elements.Add (new Horseman (graphics, new Vector2(200,30), new Vector2(1,1)));

            tc = new TownCenter(graphics, new Vector2(400, 300), new Vector2(1, 1));

            Random rnd = new Random();

            int xpos, ypos, xdir, ydir, type;

            for (int i = 0; i < 1000; i++)
            {
                xpos = rnd.Next(Globals.left, Globals.right);
                ypos = rnd.Next(Globals.top, Globals.bottom);
                xdir = 1;
                ydir = 1;
                type = rnd.Next(1, 6 + 1);
                switch (type)
                {
                case 1:
                    k = new Knight(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir), tc);
                    game_elements.Add(k);
                    #region Observer Pattern
                    tc.RegisterObserver(k);
                    #endregion
                    break;

                case 2:
                    hm = new Horseman(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir), tc);
                    game_elements.Add(hm);
                    #region Observer Pattern
                    tc.RegisterObserver(hm);
                    #endregion
                    break;

                case 3:
                    b = new Bishop(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir), tc);
                    game_elements.Add(b);
                    #region Observer Pattern
                    tc.RegisterObserver(b);
                    #endregion
                    break;

                case 4:
                    cwb = new Clockworkbeast(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir), tc);
                    game_elements.Add(cwb);
                    #region Observer Pattern
                    tc.RegisterObserver(cwb);
                    #endregion
                    break;

                case 5:
                    mb = new Mathbeast(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir), tc);
                    game_elements.Add(mb);
                    #region Observer Pattern
                    tc.RegisterObserver(mb);
                    #endregion
                    break;

                case 6:
                    md = new MadDog(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir), tc);
                    game_elements.Add(md);
                    #region Observer Pattern
                    tc.RegisterObserver(md);
                    #endregion
                    break;
                }
                System.Threading.Thread.Sleep(1);
            }
        }
Пример #6
0
 public ToTownCenterWalk(TownCenter towncenter)
 {
     tc = towncenter;
 }