Esempio n. 1
0
        public void LoadContent(GraphicsDeviceManager g, Game ga)
        {
            graphics = g;
            graphics.IsFullScreen = false;
            game = ga;

            game_elements = new List <GameEntity> ();

            #region Composite Pattern
            selectedGroup = new GameEntityGroup(graphics);
            #endregion

            #region State Pattern
            // The Gameworld State Machine is also a singleton
            gwStateMachine = GWStateMachine.Instance;
            gwStateMachine.Initialize();
            #endregion


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

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

            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, 3 + 1);
                switch (type)
                {
                case 1:
                    game_elements.Add(new Knight(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir)));
                    break;

                case 2:
                    game_elements.Add(new Horseman(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir)));
                    break;

                case 3:
                    game_elements.Add(new Bishop(graphics, new Vector2(xpos, ypos), new Vector2(xdir, ydir)));
                    break;
                }
                System.Threading.Thread.Sleep(1);
            }
        }
Esempio n. 2
0
 public GWTranslateState(GWStateMachine gwStateMachine)
 {
     this.gwStateMachine = gwStateMachine;
 }
Esempio n. 3
0
 public GWSelectState(GWStateMachine gwStateMachine)
 {
     this.gwStateMachine = gwStateMachine;
 }
Esempio n. 4
0
 public GWNormalState(GWStateMachine gwStateMachine)
 {
     this.gwStateMachine = gwStateMachine;
 }