/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); Views = new List<View>(); var Board = new PacManMulti.Logic.Board(); Board.Height = 10; Board.Width = 15; Random rand = new Random(); BoardUI BoardUI = new BoardUI(Board, Window.ClientBounds.Width, Window.ClientBounds.Height-30, 0, 30); for (int i = 0; i < 10; i++) { Element e = (Element)new PacPlayer(); e.X = rand.Next(15); e.Y = rand.Next(10); //e.P = new Point(rand.Next(15), rand.Next(10)); Sprite s = new SpriteDemo(e); Board.board.Add(e); BoardUI.RegisterSprite(s); } Views.Add(BoardUI); Views.Add(new Score(Window.ClientBounds.Width, 30, 0, 0)); foreach (View v in Views) { v.Initialize(this); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); Views = new List <View>(); var Board = new PacManMulti.Logic.Board(); Board.Height = 10; Board.Width = 15; Random rand = new Random(); BoardUI BoardUI = new BoardUI(Board, Window.ClientBounds.Width, Window.ClientBounds.Height - 30, 0, 30); for (int i = 0; i < 10; i++) { Element e = (Element) new PacPlayer(); e.X = rand.Next(15); e.Y = rand.Next(10); //e.P = new Point(rand.Next(15), rand.Next(10)); Sprite s = new SpriteDemo(e); Board.board.Add(e); BoardUI.RegisterSprite(s); } Views.Add(BoardUI); Views.Add(new Score(Window.ClientBounds.Width, 30, 0, 0)); foreach (View v in Views) { v.Initialize(this); } }