Esempio n. 1
0
        public UnitHandler(Game game, CombatScreen screen)
        {
            this.game = game;
            this.screen = screen;

            units = new Unit[6];
            rand = new Random();

            pathfinder = new Pathfinder(screen.DataMaster.map);

            //Fill units with infantery.
            //TODO:: make this better.
            for (int i = 0; i < units.Length; i++)
            {
                units[i] = new Infantery();
                units[i].Position = new SFML.Window.Vector2f(
                    (float)Math.Round((double)rand.Next(0, 800/32)) * 32,
                    (float)Math.Round((double)rand.Next(0, 640 / 32)) * 32);
            }

            units[units.Length - 1] = new Tank();
            units[units.Length - 1].Position = new SFML.Window.Vector2f(
            (float)Math.Round((double)rand.Next(0, 800 / 32)) * 32,
            (float)Math.Round((double)rand.Next(0, 640 / 32)) * 32);

            screen.DataMaster.Units = units;
        }
Esempio n. 2
0
        public UnitHandler(Game game, CombatScreen screen)
        {
            this.game = game;
            this.screen = screen;

            units = new List<Unit>();
            rand = new Random();

            pathfinder = new Pathfinder(screen.DataMaster.map);

            //Fill units list with infantery.
            for (int i = 0; i < 6; i++)
            {
                units.Add(new Infantery());
                units[i].Position = new SFML.Window.Vector2f(
                    (float)Math.Round((double)rand.Next(0, 800/32)) * 32,
                    (float)Math.Round((double)rand.Next(0, 640 / 32)) * 32);
            }
            screen.DataMaster.Units = units;
        }