Beispiel #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (MainGameClass game = new MainGameClass())
     {
         game.Run();
     }
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameplayScreen(Game game)
            : base(game)
        {
            mGame = (MainGameClass)game;
            mGame.MainCamera.InitializeView(640,480,0,0);
            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            eventManager = new EventManager();

            soundManager = new SoundManager();
            aiManager = new AIManager();
            sceneManager = new SceneManager();

            soundManager.SubscribeToHandler(eventManager);

            eventManager.FireSoundEvent(new Player(), new SoundEventArgs(1.0, 1));
        }
Beispiel #3
0
        /// <summary>
        /// Constructs a new level.
        /// </summary>
        /// <param name="serviceProvider">
        /// The service provider that will be used to construct a ContentManager.
        /// </param>
        /// <param name="fileStream">
        /// A stream containing the tile data.
        /// </param>
        public Level(IServiceProvider serviceProvider, Game game, int levelIndex, Texture2D background)
            : base(game)
        {
            _levelIndex = levelIndex;

            _game = (MainGameClass)game;

            _camera = _game.MainCamera;

            _camera.InitializeView(640,480, 0, 0);

            // Create a new content manager to load content used just by this level.
            levelContent = new ContentManager(serviceProvider, "Content");

            //makes a new array of backgrounds
            backgroundLayers = new Texture2D[_backgrounds];
            for (int i = 0; i < backgroundLayers.Length; ++i)
            {
                // Choose a random segment if each background layer for level variety.
                int segmentIndex = levelIndex;
                backgroundLayers[i] = LevelContent.Load<Texture2D>("PHArt/bgDefault.jpg");
            }
        }