public TileMapLayer(Screen parentScreen, SpriteBatch spriteBatch, TileMap tm, int layerIndex, float scrollSpeed) : this(parentScreen, spriteBatch, tm, layerIndex) { this.drawEdgesEnabled = false; this.drawBlanksEnabled = false; this.scrollSpeed = scrollSpeed; }
/// <summary> /// Constructor /// </summary> /// <param name="game">The game object this component is associated with</param> /// <param name="spriteBatch">The sprite batch that this component is to use to draw itself</param> /// <param name="position">The coordinates that this component is to be drawn at</param> public DrawableGameObject(Screen parentScreen, SpriteBatch spriteBatch, Vector2 position) : base(ScreenManager.Instance) { ParentScreen = parentScreen; this.spriteBatch = spriteBatch; this.position = position; }
/// <summary> /// Create an empty world. /// </summary> /// <param name="parentScreen">The screen this world will be updated in.</param> public World(Screen parentScreen, Player player) : base(parentScreen) { this.worldObjects = new List<WorldObject>(); this.player = player; ParentScreen.Components.Add(player); this.interactiveLayers = new Dictionary<int, TileMapLayer>(); this.parallaxLayers = new Dictionary<int, TileMapLayer>(); batchService = (ISpriteBatchService)this.Game.Services.GetService(typeof(ISpriteBatchService)); otherMaps = new List<TileMap>(); //Set up Sound systems audioEngine = new AudioEngine("Content\\System\\Sounds\\Win\\SoundFX.xgs"); soundBank = new SoundBank(audioEngine, "Content\\System\\Sounds\\Win\\GameSoundBank.xsb"); waveBank = new WaveBank(audioEngine, "Content\\System\\Sounds\\Win\\GameWavs.xwb"); // Set up our collision systems: spriteCollisionManager = new SpriteSpriteCollisionManager(this.Game, batchService, 40, 40); ParentScreen.Components.Add(spriteCollisionManager); bgm = this.Game.Content.Load<Song>("System\\Music\\DesertBGM"); MediaPlayer.IsRepeating = true; MediaPlayer.Play(bgm); LoadCtorInfos(); }
public GameOverContents(Screen parentScreen, SpriteBatch batch, Vector2 position) : base(parentScreen, batch, position) { displayStartString = true; pressStartPosition += position; }
public Timer(Screen parentScreen, int timeToWait) : base(parentScreen) { paused = false; elaspedTime = 0; this.timeToWait = timeToWait; }
public TileMapLayer(Screen parentScreen, SpriteBatch spriteBatch, TileMap tm, int layerIndex) : base(parentScreen, spriteBatch, Vector2.Zero) { this.drawEdgesEnabled = false; this.drawBlanksEnabled = false; this.drawDestructablesEnabled = false; this.layerIndex = layerIndex; scrollSpeed = 1.0f; this.tm = tm; }
internal EBossJumpState(Screen parentScreen, EBoss boss) : base(boss) { jumpTimer = new Timer(parentScreen, DELAY_BETWEEN_JUMP_DECISION); jumpTimer.TimeHasElapsed += new EventHandler<EventArgs>(jumpTimer_TimeHasElapsed); fallThroughTimer = new Timer(parentScreen, AMOUNT_OF_TIME_TO_TURN_OFF_TILE_COLLISION_DOWN); fallThroughTimer.TimeHasElapsed += new EventHandler<EventArgs>(fallThroughTimer_TimeHasElapsed); jumpThroughTimer = new Timer(parentScreen, AMOUNT_OF_TIME_TO_TURN_OFF_TILE_COLLISION_UP); jumpThroughTimer.TimeHasElapsed += new EventHandler<EventArgs>(jumpThroughTimer_TimeHasElapsed); lastJumpPosition = new Vector2(); }
public StoryboardInformation(Screen screen, Texture2D texture, string text, Vector2 textPosition, bool isTransitionAutomatic, int automaticTransitionDelay) { this.sceneTexture = texture; this.sceneText = text; this.sceneTextPosition = textPosition; this.isTransitionAutomatic = isTransitionAutomatic; isTimerStarted = false; if (isTransitionAutomatic) { timer = new Timer(screen, automaticTransitionDelay); timer.TimeHasElapsed += new EventHandler<EventArgs>(timer_TimeHasElapsed); } }
/// <summary> /// Constructor for Flint's Hat. /// </summary> /// <param name="parentScreen">The screen which this object is a part of.</param> /// <param name="spriteBatch">The sprite batch which handles drawing this object.</param> /// <param name="position">The initial position of this character.</param> public SpaceBoss(Screen gameScreen, World world, SpriteBatch spriteBatch, Vector2 position, Character owner) : base(world, spriteBatch, position) { mass = 1.0f; //Set the Hat's owner this.owner = owner; this.gameScreen = gameScreen; //Set up the Animation Map animationMap = new Dictionary<string, Animation>(); //Set up the Hat's Animations SetUpAnimation(); animationPlayer = new AnimationPlayer(spriteBatch, animationMap["Fall"]); currentState = "None"; //Set the Hat's positon if (owner.Facing == SpriteEffects.FlipHorizontally) { Position = owner.Position + new Vector2(20, -29); } else { Position = owner.Position + new Vector2(-20, -30); } //Set the hat's velocity if (currentState.Contains("Fall")) { velocity = new Vector2(0, 0); } //Initializes the hat's hotspots. List<CollisionHotspot> hotspots = new List<CollisionHotspot>(); hotspots.Add(new CollisionHotspot(this, new Vector2(-1, -10), HOTSPOT_TYPE.top)); hotspots.Add(new CollisionHotspot(this, new Vector2(-7, 1), HOTSPOT_TYPE.left)); hotspots.Add(new CollisionHotspot(this, new Vector2(5, 1), HOTSPOT_TYPE.right)); hotspots.Add(new CollisionHotspot(this, new Vector2(-1, 12), HOTSPOT_TYPE.bottom)); Hotspots = hotspots; this.world = world; world.AddWorldObject(this); //this.ParentScreen.Components.Add(this); }
internal EBossShootState(EBoss boss, Screen parentScreen) : base(boss) { //gunShot = ScreenManager.Instance.Content.Load<SoundEffect>("System\\Sounds\\mgkidShot"); shootTimer = new Timer(parentScreen, 3000); shootTimer.TimeHasElapsed += new EventHandler<EventArgs>(shootTimer_TimeHasElapsed); delayBetweenBullet = new Timer(parentScreen, 50); delayBetweenBullet.TimeHasElapsed += new EventHandler<EventArgs>(delayBetweenBullet_TimeHasElapsed); laughTimer = new Timer(parentScreen, 3000); laughTimer.TimeHasElapsed += new EventHandler<EventArgs>(laughTimer_TimeHasElapsed); isReadyToShoot = true; hasTimerStarted = false; currentBulletCount = 0; }
/// <summary> /// Constructor for Flint's Hat. /// </summary> /// <param name="parentScreen">The screen which this object is a part of.</param> /// <param name="spriteBatch">The sprite batch which handles drawing this object.</param> /// <param name="position">The initial position of this character.</param> public FlintHat(Screen gameScreen, World world, SpriteBatch spriteBatch, Vector2 position, Character owner) : base(world, spriteBatch, position) { mass = 1.0f; //Set the Hat's owner this.owner = owner; this.gameScreen = gameScreen; //Set up the Animation Map animationMap = new Dictionary<string, Animation>(); //Set up the Hat's Animations SetUpAnimation(); //Set the current Animation currentAnimation = animationMap["Fall"]; animationPlayer = new AnimationPlayer(spriteBatch, animationMap["Fall"]); currentState = "None"; //Set the Hat's positon position = owner.Position + new Vector2(60, 0); //Set the hat's velocity velocity = new Vector2(0, 0); //Initializes the hat's hotspots. List<CollisionHotspot> hotspots = new List<CollisionHotspot>(); hotspots.Add(new CollisionHotspot(this, new Vector2(-1, -10), HOTSPOT_TYPE.top)); hotspots.Add(new CollisionHotspot(this, new Vector2(-7, 1), HOTSPOT_TYPE.left)); hotspots.Add(new CollisionHotspot(this, new Vector2(5, 1), HOTSPOT_TYPE.right)); hotspots.Add(new CollisionHotspot(this, new Vector2(-1, 12), HOTSPOT_TYPE.bottom)); Hotspots = hotspots; this.world = world; world.AddWorldObject(this); //this.ParentScreen.Components.Add(this); }
/// <summary> /// Constructor /// </summary> /// <param name="game">The game object this component is associated with</param> public MouseWorldCoordinatesComponent(Screen parentScreen) : base(parentScreen) { }
/// <summary> /// Constructor /// </summary> /// <param name="game">The game this component is tied to</param> /// <param name="map">The map we will be using to calculate the coordinates</param> public MapCoordinateComponent(Screen parentScreen, IMapCoordinates map) : base(parentScreen) { this.map = map; }
/// <summary> /// Constructor /// </summary> /// <param name="parentScreen">The parent screen that the game UI is part of</param> /// <param name="spriteBatch">The SpriteBatch object that the game UI is to use to draw itself</param> /// <param name="position">The position of the Game UI in absolute coordinates</param> public GameUI(Screen parentScreen, SpriteBatch spriteBatch, Vector2 position, IDamageable player) : base(parentScreen, spriteBatch, position) { this.player = player; }
/// <summary> /// TODO /// </summary> /// <param name="parentScreen"></param> public FPSComponent(Screen parentScreen) : base(parentScreen, null, Vector2.Zero) { }
/// <summary> /// Constructor /// </summary> /// <param name="game">The game object this component is associated with</param> /// <param name="spriteBatch">The sprite batch instance to use to draw on the screen</param> /// <param name="position">The position of this component on the screen</param> public DebuggingOutputComponent(Screen parentScreen, SpriteBatch spriteBatch, Vector2 position) : base(parentScreen, spriteBatch, position) { debugLines = new List<IDebugOutput>(); }
/// <summary> /// Load a world from an XML file. /// </summary> /// <param name="parentScreen">The screen this world will be updated in.</param> /// <param name="fileName">The name of the XML file that contains this World's information.</param> public World(Screen parentScreen, string fileName) : base(parentScreen) { this.worldObjects = new List<WorldObject>(); this.interactiveLayers = new Dictionary<int, TileMapLayer>(); this.parallaxLayers = new Dictionary<int, TileMapLayer>(); batchService = (ISpriteBatchService)this.Game.Services.GetService(typeof(ISpriteBatchService)); otherMaps = new List<TileMap>(); // Set up our collision systems: spriteCollisionManager = new SpriteSpriteCollisionManager(this.Game, batchService, 40, 40); ParentScreen.Components.Add(spriteCollisionManager); //Set up Sound systems audioEngine = new AudioEngine("Content\\System\\Sounds\\SoundFX.xgs"); soundBank = new SoundBank(audioEngine, "Content\\System\\Sounds\\GameSoundBank.xsb"); waveBank = new WaveBank(audioEngine, "Content\\System\\Sounds\\GameWavs.xwb"); bgm = this.Game.Content.Load<Song>("System\\Music\\DesertBGM"); MediaPlayer.IsRepeating = true; MediaPlayer.Play(bgm); // The spritebatch to be used when creating all of our worldObjects: spriteBatch = batchService.GetSpriteBatch(Character.SpriteBatchName); LoadCtorInfos(); // Load the contents of the world from the specified XML file: LoadWorldXmlFile(fileName); }
/// <summary> /// Removes a screen from being drawn and updated /// </summary> /// <param name="screen">The screen to be removed</param> public void RemoveScreenFromDisplay(Screen screen) { if (this.Components.Contains(screen)) { this.Components.Remove(screen); } }
/// <summary> /// Adds a screen to be rendered on every draw and updated every update /// </summary> /// <param name="screen">The screen to add to the currently drawn screens</param> public void AddScreenToDisplay(Screen screen) { if (!this.Components.Contains(screen)) { this.Components.Add(screen); } }
public GameObject(Screen parentScreen) : base(ScreenManager.Instance) { ParentScreen = parentScreen; }