//Idealement le nom et la taille du tileset vont tous aller dans le fichier lvl.dat ou wtv, et on va juste passer game et levelName public Level(ZombieGame game, string levelName) : base(game) { StreamReader levelData = new StreamReader("Content/Levels/" + levelName + ".dat"); string tilesetName = levelData.ReadLine(); int tilesetRows = int.Parse(levelData.ReadLine()); int tilesetColumns = int.Parse(levelData.ReadLine()); Height = int.Parse(levelData.ReadLine()); Width = int.Parse(levelData.ReadLine()); TileType = new int[Height, Width]; for (int i = 0; i < Height; ++i) { string[] numbers = levelData.ReadLine().Split(' '); for (int j = 0; j < Width; ++j) { TileType[i, j] = int.Parse(numbers[j]); } } ZombieGame = game; Tileset = new Tileset(ZombieGame.TextureMgr.Find(tilesetName), tilesetRows, tilesetColumns); }
public Shotgun(ZombieGame game, Vector2 initPos) : base(game, initPos, NAME, DAMAGE, 96, 96, 12, FIRE_RATE, BULLET_SPEED, false, RELOAD_TIME) { Emitters.Add(new ParticleEmitter(game, 50, false, FIRE_RATE, new Vector2(Sprite.Position.X - EMITTERS_OFFSET, Sprite.Position.Y))); Emitters.Add(new ParticleEmitter(game, 50, false, FIRE_RATE, new Vector2(Sprite.Position.X + EMITTERS_OFFSET, Sprite.Position.Y))); ShotgunPump = game.SfxMgr.Find("ShotgunPump"); }
public AnimatedSprite(ZombieGame game, string fileName, int frames, int lines, Vector2 position, float depth, float updateTime) : base(game, fileName, position, depth) { Frames = frames; Lines = lines; CurLine = 0; CurFrame = 0; IsLooping = false; UpdateTime = updateTime; ElapsedTime = 0.0f; FrameWidth = Width / Frames; FrameHeight = Height / Lines; Rectangles = new Rectangle[Lines, Frames]; //Like a matrix, the first index is the row (line), the second the column (frame) for (int i = 0; i < Lines; ++i) { for (int j = 0; j < Frames; ++j) { Rectangles[i, j] = new Rectangle(j * FrameWidth, i * FrameHeight, FrameWidth, FrameHeight); } } }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (ZombieGame game = new ZombieGame()) { game.Run(); } }
public Camera(ZombieGame game) : base(game) { ZombieGame = game; View = game.GraphicsDevice.Viewport; PlayerSize = new Vector2(game.Player.Sprite.FrameWidth, game.Player.Sprite.FrameHeight); ScreenSize = new Vector2(game.Graphics.PreferredBackBufferWidth, game.Graphics.PreferredBackBufferHeight); }
public Enemy(ZombieGame game, Vector2 initPos, string spriteName, int spriteFrames, int spriteLines, float depth, float updateTime, int maxHealth, int damage, float maxSpeed, float attackDelay) : base(game, spriteName, spriteFrames, spriteLines, initPos, depth, updateTime, maxHealth, maxSpeed) { Damage = damage; Sprite.IsLooping = true; DamageSound = ZombieGame.SfxMgr.Find(spriteName + "Damage"); AttackDelay = attackDelay; }
public Particle(ZombieGame game, string fileName, Vector2 position, Vector2 direction, float life, float depth, float speed) : base(game, fileName, position, depth) { Direction = direction; Life = life; Speed = speed; IsAlive = true; }
public Player(ZombieGame game, Vector2 initPos) : base(game, SPRITE_NAME, SPRITE_FRAMES, SPRITE_LINES, initPos, DEPTH, UPDATE_TIME, MAX_HEALTH, MAX_SPEED) { GunBelt = new List <Tuple <string, Gun> >(); PopulateGunBelt(game, initPos); CurrentGun = 0; Gun = GunBelt[CurrentGun].Item2; Gun.IsSelected = true; }
public Player(ZombieGame game, Vector2 initPos) : base(game, SPRITE_NAME, SPRITE_FRAMES, SPRITE_LINES, initPos, DEPTH, UPDATE_TIME, MAX_HEALTH, MAX_SPEED) { GunBelt = new List<Tuple<string, Gun>>(); PopulateGunBelt(game, initPos); CurrentGun = 0; Gun = GunBelt[CurrentGun].Item2; Gun.IsSelected = true; }
public Emitter(ZombieGame game, int maxParticles, bool automaticSpawn, float timeBetweenSpawn) : base(game) { ZombieGame = game; TimeBetweenSpawn = timeBetweenSpawn; AutomaticSpawn = automaticSpawn; TimeSinceLastSpawn = 0.0f; ActiveParticles = new LinkedList<Particle>(); }
public Pickable(ZombieGame game, string spriteName, int spriteFrames, int spriteLines, Vector2 spawningLocation, float depth, float updateTime) : base(game) { ZombieGame = game; IsPickedUp = false; SpawningLocation = spawningLocation; Sprite = new AnimatedSprite(ZombieGame, spriteName, spriteFrames, spriteLines, spawningLocation, depth, updateTime); HoveringSprite = new AnimatedSprite(ZombieGame, "Pickme", 1, 1, new Vector2(spawningLocation.X - 24.0f, spawningLocation.Y - 20.0f), depth, updateTime); //Ajout le pickupsound }
public Emitter(ZombieGame game, int maxItems, bool automaticSpawn, float timeBetweenSpawn, Vector2 position) : base(game) { ZombieGame = game; MaxItems = maxItems; AutomaticSpawn = automaticSpawn; TimeBetweenSpawn = timeBetweenSpawn; TimeSinceLastSpawn = TimeBetweenSpawn; Position = position; }
public Character(ZombieGame game, string spriteName, int spriteFrames, int spriteLines, Vector2 initPos, float depth, float updateTime, int maxHealth, float maxSpeed) : base(game) { ZombieGame = game; Sprite = new AnimatedSprite(ZombieGame, spriteName, spriteFrames, spriteLines, initPos, depth, updateTime); MaxHealth = maxHealth; Health = MaxHealth; IsAlive = true; MaxSpeed = maxSpeed; DamageSound = ZombieGame.SfxMgr.Find("DefaultDamage"); }
public Gun(ZombieGame game, Vector2 initPos) : base(game) { ZombieGame = game; Sprite = new Sprite(ZombieGame, "Pistol", initPos, 0.0f); Sprite.Origin = new Vector2(0, Sprite.Height / 2); Sprite.Rotation = 3 * MathHelper.PiOver2; Emitters = new List<Emitter>(); Emitters.Add(new Emitter(ZombieGame, 100, false, PISTOL_FIRE_RATE)); IsShooting = false; GunShotSound = ZombieGame.SfxMgr.Find("PistolShot"); }
private void PopulateGunBelt(ZombieGame game, Vector2 initPos) { Pistol pistol = new Pistol(game, initPos); pistol.IsPickedUp = true; // Player starts with the pistol picked up Shotgun shotgun = new Shotgun(game, initPos); SMG smg = new SMG(game, initPos); GunBelt.Add(new Tuple <string, Gun>("Pistol", pistol)); GunBelt.Add(new Tuple <string, Gun>("Shotgun", shotgun)); GunBelt.Add(new Tuple <string, Gun>("SMG", smg)); NumberOfGuns = GunBelt.Count; }
public Gun(ZombieGame game, Vector2 initPos, string gunName, int damage, int maxAmmo, int ammo, int clipSize, float fireRate, float bulletSpeed, bool infiniteAmmo, float reloadingTime) : base(game) { ZombieGame = game; GunName = gunName; Damage = damage; InfiniteAmmo = infiniteAmmo; ReloadingTime = reloadingTime; MaxAmmo = maxAmmo; Ammo = ammo; ClipSize = clipSize; if (!InfiniteAmmo) { if (Ammo >= ClipSize) { ClipAmmo = ClipSize; } else { ClipAmmo = Ammo; } Ammo -= ClipAmmo; } else { ClipAmmo = ClipSize; } FireRate = fireRate; BulletSpeed = bulletSpeed; Sprite = new Sprite(ZombieGame, GunName, initPos, 0.0f); Sprite.Origin = new Vector2(0, Sprite.Height / 2); Sprite.Rotation = 3 * MathHelper.PiOver2; Emitters = new List <ParticleEmitter>(); IsShooting = false; IsReloading = false; GunShotSound = ZombieGame.SfxMgr.Find(GunName + "Shot"); GunReloadSound = ZombieGame.SfxMgr.Find(GunName + "Reload"); IsSelected = false; IsPickedUp = false; }
public Sprite(ZombieGame game, string fileName, Vector2 position, float depth) : base(game) { ZombieGame = game; SpriteSheet = ZombieGame.TextureMgr.Find(fileName); Position = position; Rotation = 0.0f; Scale = 1.0f; Color = Color.White; Origin = Vector2.Zero; Effects = SpriteEffects.None; Depth = depth; Height = SpriteSheet.Height; Width = SpriteSheet.Width; }
public Gun(ZombieGame game, Vector2 initPos, string gunName, int damage, int maxAmmo, int ammo, int clipSize, float fireRate, float bulletSpeed, bool infiniteAmmo, float reloadingTime) : base(game) { ZombieGame = game; GunName = gunName; Damage = damage; InfiniteAmmo = infiniteAmmo; ReloadingTime = reloadingTime; MaxAmmo = maxAmmo; Ammo = ammo; ClipSize = clipSize; if (!InfiniteAmmo) { if (Ammo >= ClipSize) ClipAmmo = ClipSize; else ClipAmmo = Ammo; Ammo -= ClipAmmo; } else ClipAmmo = ClipSize; FireRate = fireRate; BulletSpeed = bulletSpeed; Sprite = new Sprite(ZombieGame, GunName, initPos, 0.0f); Sprite.Origin = new Vector2(0, Sprite.Height / 2); Sprite.Rotation = 3 * MathHelper.PiOver2; Emitters = new List<ParticleEmitter>(); IsShooting = false; IsReloading = false; GunShotSound = ZombieGame.SfxMgr.Find(GunName + "Shot"); GunReloadSound = ZombieGame.SfxMgr.Find(GunName + "Reload"); IsSelected = false; IsPickedUp = false; }
public GunPickable(ZombieGame game, Vector2 spawningLocation, string gunName) : base(game, gunName, 1, 1, spawningLocation, DEPTH, UPDATE_TIME) { ZombieGame = game; GunName = gunName; }
private void PopulateGunBelt(ZombieGame game, Vector2 initPos) { Pistol pistol = new Pistol(game, initPos); pistol.IsPickedUp = true; // Player starts with the pistol picked up Shotgun shotgun = new Shotgun(game, initPos); SMG smg = new SMG(game, initPos); GunBelt.Add(new Tuple<string, Gun>("Pistol", pistol)); GunBelt.Add(new Tuple<string, Gun>("Shotgun", shotgun)); GunBelt.Add(new Tuple<string, Gun>("SMG", smg)); NumberOfGuns = GunBelt.Count; }
public Zombie(ZombieGame game, Vector2 initPos) : base(game, initPos, SPRITE_NAME, SPRITE_FRAMES, SPRITE_LINES, DEPTH, UPDATE_TIME, MAX_HEALTH, MAX_DAMAGE, MAX_SPEED, ATTACK_DELAY) { }
public ParticleEmitter(ZombieGame game, int maxParticles, bool automaticSpawn, float timeBetweenSpawn, Vector2 position) : base(game, maxParticles, automaticSpawn, timeBetweenSpawn, position) { ActiveParticles = new List<Particle>(); }
public FpsDisplay(ZombieGame game, string fontName) : base(game) { ZombieGame = game; FontName = fontName; }
public HUD(ZombieGame game, string fontName) : base(game) { ZombieGame = game; FontName = fontName; }
public ResourceManager(ZombieGame game) { ZombieGame = game; Resources = new List <BaseResource <T> >(); }
public SMG(ZombieGame game, Vector2 initPos) : base(game, initPos, NAME, DAMAGE, 1000, 320, 32, FIRE_RATE, BULLET_SPEED, false, RELOAD_TIME) { Emitters.Add(new ParticleEmitter(game, 50, false, FIRE_RATE, Sprite.Position)); }
public Character(ZombieGame game, string spriteName, int spriteFrames, int spriteLines, Vector2 initPos, float depth) : base(game) { ZombieGame = game; Sprite = new AnimatedSprite(ZombieGame, spriteName, spriteFrames, spriteLines, initPos, depth); }
public ParticleEmitter(ZombieGame game, int maxParticles, bool automaticSpawn, float timeBetweenSpawn, Vector2 position) : base(game, maxParticles, automaticSpawn, timeBetweenSpawn, position) { ActiveParticles = new List <Particle>(); }
public EnemySpawner(ZombieGame game, int maxEnemies, bool automaticSpawn, float timeBetweenSpawn, Vector2 position) : base(game, maxEnemies, automaticSpawn, timeBetweenSpawn, position) { ActiveEnemies = new LinkedList<Enemy>(); }
public EnemySpawner(ZombieGame game, int maxEnemies, bool automaticSpawn, float timeBetweenSpawn, Vector2 position) : base(game, maxEnemies, automaticSpawn, timeBetweenSpawn, position) { ActiveEnemies = new LinkedList <Enemy>(); }
public Player(ZombieGame game, Vector2 initPos) : base(game, SPRITE_NAME, SPRITE_FRAMES, SPRITE_LINES, initPos, DEPTH) { }
public Ennemy(ZombieGame game, Vector2 initPos, float maxSpeed) : base(game, SPRITE_NAME, SPRITE_FRAMES, SPRITE_LINES, initPos, DEPTH) { MaxSpeed = maxSpeed; }