Exemplo n.º 1
0
        public Bouncing()
        {
            clearColor = new Color(22,22,22);
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            Content.RootDirectory = "Content";

            screenSystem = new ScreenSystem(this);
            Components.Add(screenSystem);

            objectManager = new ObjectManager(this);
            collisionDetectionService = new CollisionDetectionCircleService(this);

            _input = new InputManager(this);

            Services.AddService(typeof(ObjectManager), objectManager);
            Services.AddService(typeof(IManageCollisionsService), collisionDetectionService);
            Services.AddService(typeof(IInputService), _input);
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            starsCollected = 1;
            levelManager = new LevelManager();
            levelManager.Init(ScreenSystem.Game, ScreenSystem.SpriteBatch);
            if (level == 0)
            {
                curLevel = levelManager.NextLevel();
            }
            else
            {
                curLevel = levelManager.GetLevel(level);
            }

            //Inits the audio
            switch (level)
            {
                case 1:
                    audioManager = new AudioManager("spacetheme");
                    break;
                case 2:
                    audioManager = new AudioManager("spacetheme");
                    break;
                case 3:
                    audioManager = new AudioManager("lavatheme");
                    break;
            }

            audioManager.LoadContent();

            objectManager = (ObjectManager)ScreenSystem.Game.Services.GetService((typeof(ObjectManager)));
            collisionManager = (IManageCollisionsService)ScreenSystem.Game.Services.GetService((typeof(IManageCollisionsService)));
            _input = (InputManager)ScreenSystem.Game.Services.GetService(typeof(IInputService));
            input = ScreenSystem.InputSystem;
            input.NewAction("Pause", Keys.Escape);
            screenOverlayManager = new ScreenOverlayManager(ScreenSystem.Game, this);
            ScreenSystem.Game.Components.Add(screenOverlayManager);
            Entering += new TransitionEventHandler(PlayScreen_Entering);
        }