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); }
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); }
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))); }
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; }
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)); }
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); }
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); }
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); }
/// <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(); }
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)); }
/// <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; }