Esempio n. 1
0
        public Manager(Game game)
            : base(game)
        {
            computer = new IA(this);

            Random generation = new System.Random();

            TouchPanel.EnabledGestures = GestureType.FreeDrag | GestureType.DragComplete;

            List<Vector2> coordFactory = new List<Vector2>();

            int numFactory = generation.Next(8, 15);

            int widthFactory = Game.GraphicsDevice.Viewport.Width / 7;
            int heightFactory = Game.GraphicsDevice.Viewport.Height / 3;

            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 3; j++)
                    coordFactory.Add(new Vector2(widthFactory * i, heightFactory * j));
            }

            for (int i = 0; i < numFactory; i++)
            {
                int posFactory = generation.Next(0, coordFactory.Count);

                if (i == 0)
                {
                    factories.Add(new Factory(game, 1, coordFactory[posFactory], capitalFactoryCap));
                }
                else if (i == numFactory - 1)
                {
                    factories.Add(new Factory(game, 2, coordFactory[posFactory], capitalFactoryCap));
                }
                else
                {
                    factories.Add(new Factory(game, 0, coordFactory[posFactory], generation.Next(neutralFactoryMinCap, neutralFactoryMaxCap)));
                }

                coordFactory.Remove(coordFactory[posFactory]);
            }

            computer.loadNeutralFactories();
        }