public GameAccess() { this.Screen = new ScreenAccess(); this.sound = new SoundAccess(this.Screen); this.InputDeviceManager = new InputDeviceManagerAccess(this.Screen); this.Writer = new WriterAccess(this.Screen); //Check the App.config to see if it is correct GameConfig.ValidateConfigFile(); }
public static void CheckPlayerCollisions(SpriteAccess[] OtherPlayers, ParticleAccess CurrParticles, SoundAccess Sounds) { //for each player foreach (PlayableCharacterAccess CurrPlayer in OtherPlayers) { //for each weapon foreach (WeaponAccess CurrWeapon in WeaponManagerAccess.AllWeapons) { //Check collisions against players if (CurrWeapon.TypeOfWeapon != WeaponType.Grenade) { if (CurrWeapon.CollisionRects.CheckObjectRectAgainst(CurrPlayer, CurrWeapon.Frame, CurrWeapon.X, CurrWeapon.Y) != CollisionRectAccess.HitSide.None) { //remove weapon //kill player CurrPlayer.State = PlayableCharacterAccess.PlayerState.Explode; CurrWeapon.IsDead = true; //Add explosion if (CurrWeapon.TypeOfWeapon == WeaponType.SlideMine || CurrWeapon.TypeOfWeapon == WeaponType.Mine) { //CurrParticles.AddExplosion(new Vector3(CurrPlayer.X, CurrPlayer.Y, SpaceAndTime.SpriteZLocation)); CurrParticles.AddExplosion(new Vector3(CurrPlayer.X / 17, CurrPlayer.Y / 17, 0.0f)); Sounds.PlayExplosion(); } } } } } }