Esempio n. 1
0
        private void AddAdditionalShips()
        {
            for (int i = 1; i < InputManager.Xbox360GamePads.Length; i++)
            {
                if (InputManager.Xbox360GamePads[i].IsConnected)
                {
                    MainShip mainShip = new MainShip(ContentManagerName);
                    mainShip.PlayerIndex = i;
                    MainShipList.Add(mainShip);
                }
            }

            const float spacingBetweenPlayers = 60;
            const float startingX = -90;
            // Reposition all players
            for (int i = 0; i < MainShipList.Count; i++)
            {
                MainShipList[i].X = -startingX + i * spacingBetweenPlayers;
            }
        }
        public override void Initialize(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            BulletList = new PositionedObjectList<Bullet>();
            RockList = new PositionedObjectList<Rock>();
            MainShipList = new PositionedObjectList<MainShip>();
            Player1Ship = new RockBlaster.Entities.MainShip(ContentManagerName, false);
            Player1Ship.Name = "Player1Ship";
            EndGameUiInstance = new RockBlaster.Entities.EndGameUi(ContentManagerName, false);
            EndGameUiInstance.Name = "EndGameUiInstance";
            HudInstance = new RockBlaster.Entities.Hud(ContentManagerName, false);
            HudInstance.Name = "HudInstance";
            RockSpawnerInstance = new RockBlaster.Entities.RockSpawner(ContentManagerName, false);
            RockSpawnerInstance.Name = "RockSpawnerInstance";
            MainShipList.Add(Player1Ship);

            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }