コード例 #1
0
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            asteroidManager = new AsteroidManager(content, Mode.TITLE);
            starField       = new StarField(content);
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: russperlow/Asteroids
 /// <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.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     font        = Content.Load <SpriteFont>(@"Font");
     // TODO: use this.Content to load your game content here
     bm         = new BulletManager(Content.Load <Texture2D>(@"Bolt"), Content.Load <SoundEffect>(@"Kachow"));
     ship       = new Ship(Content.Load <Texture2D>(@"McQueen"), Content.Load <Texture2D>(@"McQueenBlue"), GraphicsDevice.Viewport, bm, font);
     am         = new AsteroidManager(Content, GraphicsDevice.Viewport, bm, ship);
     background = Content.Load <Texture2D>(@"Radiator_Springs");
 }
コード例 #3
0
        public SplashScreen(ContentManager content)
        {
            titleFont = content.Load <SpriteFont>("font/Menu");
            textFont  = content.Load <SpriteFont>("font/Segoe");

            asteroidManager = new AsteroidManager(content, Mode.TITLE);

            gameTitle         = new Text("XNA Asteroids", titleFont);
            pressStart        = new Text("Press ENTER to start", textFont);
            pressStart.center = new Vector2(pressStart.center.X, pressStart.center.Y + gameTitle.size.Y);
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: seanlegg/Asteroids
        public Game2(ContentManager content)
        {
            players = new List <Player>();
            players.Add(new Player(content));

            asteroidManager = new AsteroidManager(content, Mode.GAME);

            // Subscribe to Events
            //EventManager eventManager = EventManager.Instance;

            //eventManager.Subscribe(EventType.NEW_GAME, this);
        }
コード例 #5
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            gameFont = content.Load <SpriteFont>("font/gamefont");

            asteroidManager = new AsteroidManager(content, Mode.GAME);

            // Create the players ship
            if (networkSession == null)
            {
                Player p = new Player(content, ControllingPlayer);
                p.onGameOver += OnGameOver;

                // Set HUD properties
                p.ScoreRegion = scoreRegions[0];

                players.Add(p);
            }

            // Load Background Music - (http://freemusicarchive.org/music/Edward_Shallow/World_Head_Law/02_Poisons__Potions)
            backgroundMusic = content.Load <Song>("sound/background");

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            //Thread.Sleep(1000);

            // Create the star field
            starField = new StarField(content);

            // Initialize the game
            InitGame();

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
コード例 #6
0
 public TestHotKeysAdder(AsteroidManager asteroidManager)
 {
     _asteroidManager = asteroidManager;
 }
コード例 #7
0
 void Awake()
 {
     Instance = this;
 }
コード例 #8
0
 public TestHotKeysAdder(AsteroidManager asteroidManager)
 {
     _asteroidManager = asteroidManager;
 }
コード例 #9
0
 public GameController(Ship ship, AsteroidManager asteroidSpawner)
 {
     _asteroidSpawner = asteroidSpawner;
     _ship            = ship;
 }
コード例 #10
0
ファイル: GameController.cs プロジェクト: IllusiveS/Asteroids
 public GameController(Ship ship, AsteroidManager asteroidSpawner)
 {
     _asteroidSpawner = asteroidSpawner;
     _ship = ship;
 }