Ejemplo n.º 1
0
 public SpawnManager(Game game, SpriteBatch batch)
 {
     this.game        = game;
     spriteBatch      = batch;
     objectManager    = (ObjectManager)game.Services.GetService((typeof(ObjectManager)));
     collisionManager = (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService)));
     nextTime         = random.Next(0, 10);
 }
Ejemplo n.º 2
0
 public SpawnManager(Game game, SpriteBatch batch)
 {
     this.game = game;
     spriteBatch = batch;
     objectManager = (ObjectManager) game.Services.GetService((typeof(ObjectManager)));
     collisionManager = (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService)));
     nextTime = random.Next(0, 10);
 }
Ejemplo n.º 3
0
 public void LoadContent()
 {
     Art = game.Content.Load<Texture2D>(@"Pictures/beam_wall");
     collisionBox.Width = (int)_size.X;
     collisionBox.Height = (int)_size.Y;
     _sourceRectangle = new Rectangle(0, 0, 80, 1024);
     objectManager = (ObjectManager)game.Services.GetService(typeof(ObjectManager));
     collisionManager = (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService)));
 }
Ejemplo n.º 4
0
 public void Init(Game game, SpriteBatch spriteBatchToUse)
 {
     TheSpriteBatch   = spriteBatchToUse;
     TheGame          = game;
     objectManager    = (ObjectManager)TheGame.Services.GetService(typeof(ObjectManager));
     collisionManager =
         (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService)));
     objectManager.RemoveAllObjects();
     collisionManager.RemoveAllObjects();
     levelLoaded = false;
 }
Ejemplo n.º 5
0
 public void Init(Game game, SpriteBatch spriteBatchToUse)
 {
     TheSpriteBatch = spriteBatchToUse;
     TheGame = game;
     objectManager = (ObjectManager)TheGame.Services.GetService(typeof(ObjectManager));
     collisionManager =
         (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService)));
     objectManager.RemoveAllObjects();
     collisionManager.RemoveAllObjects();
     levelLoaded = false;
 }
Ejemplo n.º 6
0
        public void LoadContent()
        {
            soundEffect         = game.Content.Load <SoundEffect>(@"Audio/Sounds/star");
            soundeffectinstance = soundEffect.CreateInstance();



            image = game.Content.Load <Texture2D>(@"Images/Player/blob");
            collisionBox.Width  = 100;
            collisionBox.Height = 100;

            objectManager    = (ObjectManager)game.Services.GetService(typeof(ObjectManager));
            collisionManager = (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService)));
            _input           = (IInputService)game.Services.GetService(typeof(IInputService));
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Services
            objectManager = new ObjectManager(this);
            collisionDetectionService = new CollisionDetectionService(this);
            _input = new InputManager(this);

            Services.AddService(typeof(ObjectManager), objectManager);
            Services.AddService(typeof(IManageCollisionsService), collisionDetectionService);
            Services.AddService(typeof(IInputService), _input);

            objectManager.SetSpritebatch(spriteBatch);

            levelManager = new LevelManager.LevelManager();
            levelManager.Init(this, spriteBatch);
            curLevel = levelManager.NextLevel();

            base.Initialize();
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        public void LoadContent()
        {
            soundEffect = game.Content.Load<SoundEffect>(@"Audio/Sounds/star");
            soundeffectinstance = soundEffect.CreateInstance();

            image = game.Content.Load<Texture2D>(@"Images/Player/blob");
            collisionBox.Width = 100;
            collisionBox.Height = 100;

            objectManager = (ObjectManager) game.Services.GetService(typeof (ObjectManager));
            collisionManager = (IManageCollisionsService) game.Services.GetService((typeof (IManageCollisionsService)));
            _input = (IInputService) game.Services.GetService(typeof (IInputService));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Load content and other things
        /// </summary>
        public void LoadContent()
        {
            PlayerArt = game.Content.Load<Texture2D>(@"Pictures/player_tileset");
            collisionBox.Width = (int)_size.X/2;
            collisionBox.Height = (int)_size.Y/2;
            origo = new Vector2(SpriteWidth / 2, SpriteHeight/ 2);
            objectManager = (ObjectManager) game.Services.GetService(typeof (ObjectManager));
            collisionManager = (IManageCollisionsService) game.Services.GetService((typeof (IManageCollisionsService)));
            _input = (IInputService) game.Services.GetService(typeof (IInputService));

            _foot_ambience = game.Content.Load<SoundEffect>(
               @"Audio\Footsteps/Concrete/Footstep_Concrete_05");
            _foot_ambienceInstance = _foot_ambience.CreateInstance();
            _foot_ambienceInstance.IsLooped = true;
            _foot_ambienceTimer = _foot_ambience.Duration.TotalSeconds;
            _foot_ambience.Play();
            _footPlay = false;

            _woosh_ambience = game.Content.Load<SoundEffect>(
               @"Audio\Whoosh/short_whoosh_02");
            _woosh_ambienceInstance = _foot_ambience.CreateInstance();
            _woosh_ambienceInstance.IsLooped = true;
            _woosh_ambienceTimer = _foot_ambience.Duration.TotalSeconds;

            haveKey = false;
            doorOpen = false;
        }