Esempio n. 1
0
        /// <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()
        {
            //fit to the bg
            graphics.PreferredBackBufferWidth = 1024;
            graphics.PreferredBackBufferHeight = 768;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Content.RootDirectory = "Content";
            new FpsCounter(this, new Vector2(graphics.GraphicsDevice.Viewport.Width - 25, 5)); //displays FPS

            ConstantsForm c = new ConstantsForm();
            c.Show();

            rd = new MouseEventsManager(this);
            Vector2 startingPoint = new Vector2(Random.Next(GraphicsDevice.Viewport.Width), Random.Next(GraphicsDevice.Viewport.Height));
            antHill = new AntHill(this, startingPoint);
            this.reservoir = new Pools(this);
            this.Cemeteries = new List<Cemetery>() ;

            //ajout des fourmis
            for (int i = 0; i < NUMBER_ANTS; i++)
            {
                reservoir.pickAnt(startingPoint, 0f, 0);
            }

            //ajout de la bouffe
            for (int i = 0; i < NUMBER_FOOD; i++)
            {
                Foods.Add(new Food(this, new Vector2(Random.Next(GraphicsDevice.Viewport.Width),Random.Next(GraphicsDevice.Viewport.Height)),500));
            }

            this.IsMouseVisible = true;
            base.Initialize();
        }