Ejemplo n.º 1
0
 public void addUnitGroup(String name, BattleGroup bg)
 {
     foreach (UnitController uc in bg.m_units)
     {
         unitList.Add(uc);
     }
     m_unitGroups.Add(name, bg);
 }
Ejemplo n.º 2
0
 public void addUnitGroup(String name, BattleGroup bg)
 {
     foreach (UnitController uc in bg.m_units)
     {
         unitList.Add(uc);
     }
     m_unitGroups.Add(name, bg);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            #region loadTextures
            spriteBatch = new SpriteBatch(GraphicsDevice);
            p_icon = Content.Load<Texture2D>("P_Icon");
            bar_edge = Content.Load<Texture2D>("Bar_Edge");
            bar_eglow = Content.Load<Texture2D>("Bar_EdgeGlow");
            bar_mid = Content.Load<Texture2D>("Bar_Mid");
            bar_font = Content.Load<SpriteFont>("BarFont");
            bar_filt = Content.Load<Texture2D>("Bar_Filter");
            ko_font = Content.Load<SpriteFont>("KOCountFont");
            map_edge = Content.Load<Texture2D>("Map_Border");
            map_officer = Content.Load<Texture2D>("Map_Officer");
            #endregion

            setupDefaultAnimations();

            Minimap.initialize(bb);
            mm = new Minimap(8000, 8000, 4000, 4000, 32, 32, 128, 96, 100, map_edge, map_officer);
            mm.setDisplay(true);

            Unit a = new Unit(10050, 10080, 0, "Player");
            a.setTexture(p_icon, Color.Azure);
            a.setStats(250, 170, 100, 100, 100, 100, 100, 120, 1, 0, 4000);
            a.m_important = true;
            UnitController PLAYERCONTROLLER = new UnitController(a);
            mm.addWatchUnit(PLAYERCONTROLLER);
            BattleGroup bgA = new BattleGroup(PLAYERCONTROLLER, 1);

            WeaponAnimation whammer = WeaponAnimation.getAnimation("WEAPON-SPRITE-WARHAMMER");
            Weapon.addNewWeaponTemplate("Warhammer", Color.LightGray, whammer, new Dictionary<string, int>());
            Weapon.addSwingToWeapon("Warhammer", 18.0f, 0.8f, -1.2f, 0.6f, 10);
            Weapon.addSwingToWeapon("Warhammer", 18.0f, -1.2f, 1.0f, 0.7f, 14);
            Weapon.addSwingToWeapon("Warhammer", 24.0f, 0.0f, -0.0f, 0.95f, 18);

            Weapon w = Weapon.getWeaponFromTemplate("Warhammer");
            w.m_unitHeld = PLAYERCONTROLLER;
            a.m_weapon = w;

            #region createUnits
            Random ran = new Random();
            for (int i = 0; i < 5; i++)
            {
                Unit l = new Unit(ran.Next(600) - 300 * i + 10000, ran.Next(600) + 50 * i + 10000, 0,"Lieutenant");
                l.setStats(120, 80, 80, 80, 80, 80, 80, 80, 2, 0, 4000);
                l.setTexture(p_icon, Color.Blue);
                UnitController UCL = new UnitController(l);
                mm.addWatchUnit(UCL);
                BattleGroup BGX = new BattleGroup(UCL, 1);
                Weapon lw = Weapon.getWeaponFromTemplate("Warhammer");
                lw.m_unitHeld = UCL;
                l.m_weapon = lw;
                for (int j = 0; j < 100; j++)
                {
                    Unit f = new Unit(ran.Next(600) - 300 * i + 10000, ran.Next(600) + 50 * i + 10000, 0, "Private");
                    f.setStats(80, 50, 60, 60, 60, 60, 60, 60, 1, 0, 4000);
                    f.setTexture(p_icon, Color.LightBlue);
                    UnitController UCF = new UnitController(f);
                    BGX.addUnit(UCF);
                    Weapon fw = Weapon.getWeaponFromTemplate("Warhammer");
                    fw.m_unitHeld = UCF;
                    f.m_weapon = fw;
                }
                bb.addUnitGroup("FriendlyFodder:"+i,BGX);
            }

            for (int i = 0; i < 6; i++)
            {
                Unit l = new Unit(ran.Next(600) + 300 * i + 10000, ran.Next(600) + 50 * i + 10000, 3.0f, "Lieutenant");
                l.setStats(120, 80, 80, 80, 80, 80, 80, 80, 2, 0, 4000);
                l.setTexture(p_icon, Color.Red);
                UnitController UCL = new UnitController(l);
                mm.addWatchUnit(UCL);
                BattleGroup BGX = new BattleGroup(UCL, 2);
                Weapon lw = Weapon.getWeaponFromTemplate("Warhammer");
                lw.m_unitHeld = UCL;
                l.m_weapon = lw;
                for (int j = 0; j < 100; j++)
                {
                    Unit f = new Unit(ran.Next(600) + 600 * i + 10000, ran.Next(600) + 50 * i + 10000, 3.0f, "Private");
                    f.setStats(80, 50, 60, 60, 60, 60, 60, 60, 1, 0, 4000);
                    f.setTexture(p_icon, Color.LightPink);
                    UnitController UCF = new UnitController(f);
                    BGX.addUnit(UCF);
                    Weapon fw = Weapon.getWeaponFromTemplate("Warhammer");
                    fw.m_unitHeld = UCF;
                    f.m_weapon = fw;
                }
                bb.addUnitGroup("Fodder:" + i, BGX);
            }
            #endregion

            bb.addFaction("Player Army", 1);
            bb.addFaction("Enemy Army", 2);

            bb.addUnit(PLAYERCONTROLLER);

            barDisplayUnit = PLAYERCONTROLLER;
            bb.addUnitGroup("Player",bgA);

            bb.m_camera.setScreenSize(SCREEN_WIDTH, SCREEN_HEIGHT);
            bb.m_camera.setUnitFocus("Player");

            m_inputHandler = new UnitInputHandler(PlayerIndex.One, bb.getUnitController(a));
        }