private void Attack(SurvivorSprite survivorSprite) { this.AttackerBooleans = shotgunAttackTextureSheet.CellCollisionBooleans[0]; this.AttackerPixels = shotgunAttackTextureSheet.CellCollisionPixels[0]; this.AttackerBounds = CollisionHelper.CalculateCollisionRectangle( survivorSprite.Location.TransformMatrixForOffset(shotgunAttackTextureSheet.CellOffsets[0]), new Point(shotgunAttackTextureSheet.CellSourceRectangles[0].Width, shotgunAttackTextureSheet.CellSourceRectangles[0].Height)); this.AttackerTransformMatrix = survivorSprite.Location.TransformMatrixForOffset(shotgunAttackTextureSheet.CellOffsets[0]); MultiAttackResults multiAttackResults = survivorSprite.Game.ZombiesSubsystem.ZombiesAttackManager.AttackWithProjectile(this, DamageValue); survivorSprite.Game.Results.KillResults.ShotgunBlastKills += multiAttackResults.Kills; if (multiAttackResults.Kills > 0) { survivorSprite.Game.Results.ShotgunWeaponResults.UsageResultingInKills++; if (multiAttackResults.Kills == 2) { survivorSprite.Game.Results.KillResults.DoubleKills++; } else if (multiAttackResults.Kills == 3) { survivorSprite.Game.Results.KillResults.TripleKills++; } } else if (multiAttackResults.Damages > 0) { survivorSprite.Game.Results.ShotgunWeaponResults.UsageResultingInDamage++; } else { survivorSprite.Game.Results.ShotgunWeaponResults.UsageResultingInNoDamage++; } }
private void Attack(SurvivorSprite survivorSprite) { this.AttackerBooleans = pistolAttackTextureSheet.CellCollisionBooleans[0]; this.AttackerPixels = pistolAttackTextureSheet.CellCollisionPixels[0]; this.AttackerBounds = CollisionHelper.CalculateCollisionRectangle( survivorSprite.Location.TransformMatrixForOffset(pistolAttackTextureSheet.CellOffsets[0]), new Point(pistolAttackTextureSheet.CellSourceRectangles[0].Width, pistolAttackTextureSheet.CellSourceRectangles[0].Height)); this.AttackerTransformMatrix = survivorSprite.Location.TransformMatrixForOffset(pistolAttackTextureSheet.CellOffsets[0]); AttackResults attackResults = survivorSprite.Game.ZombiesSubsystem.ZombiesAttackManager.AttackWithProjectileSingleTarget(this, DamageValue); if (attackResults == AttackResults.Kill) { survivorSprite.Game.Results.PistolWeaponResults.UsageResultingInKills++; survivorSprite.Game.Results.KillResults.PistolShotKills++; } else if (attackResults == AttackResults.Damage) { survivorSprite.Game.Results.PistolWeaponResults.UsageResultingInDamage++; } else { survivorSprite.Game.Results.PistolWeaponResults.UsageResultingInNoDamage++; } }
public void AddPlayerTwoSurvivorSprite(SurvivorSprite survivorSprite) { SurvivorsControlManager.PlayerTwoControllableEntity = survivorSprite; Game.SpritesDrawingManager.DrawableEntities.Add(survivorSprite); SurvivorsUpdateManger.UpdatableEntities.Add(survivorSprite); SurvivorsCollisionManager.CollidableEntities.Add(survivorSprite); SurvivorsAttackManager.AttackableEntities.Add(survivorSprite); PlayerTwoSurvivorsSprite = survivorSprite; }
public void AddPlayerOneSurvivorSprite(SurvivorSprite survivorSprite) { SurvivorsControlManager.PlayerOneControllableEntity = survivorSprite; Game.SpritesDrawingManager.DrawableEntities.Add(survivorSprite); SurvivorsUpdateManger.UpdatableEntities.Add(survivorSprite); SurvivorsCollisionManager.CollidableEntities.Add(survivorSprite); SurvivorsAttackManager.AttackableEntities.Add(survivorSprite); PlayerOneSurvivorSprite = survivorSprite; }
public override void Update(GameTime gameTime, Boolean leftFireValue, Boolean rightFireValue, Boolean reload, SurvivorSprite survivorSprite) { if (rightFireValue && survivorSprite.Ammunition.GasolineInCurrentCan > 0.0f) { AttackResults attackResults = survivorSprite.PerformMeleeAttack(DamageValue); if (attackResults == AttackResults.Kill) { survivorSprite.Game.Results.ChainsawWeaponResults.UsageResultingInKills++; survivorSprite.Game.Results.KillResults.ChainsawKills++; } else if (attackResults == AttackResults.Damage) { survivorSprite.Game.Results.ChainsawWeaponResults.UsageResultingInDamage++; } else { survivorSprite.Game.Results.ChainsawWeaponResults.UsageResultingInNoDamage++; } survivorSprite.Ammunition.GasolineInCurrentCan -= GASOLINE_USAGE_RATE; } if (rightFireValue && chainsawSoundEffectInstance.State != SoundState.Playing && survivorSprite.Ammunition.GasolineInCurrentCan > 0.0f) { chainsawSoundEffectInstance.Play(); } else if (!rightFireValue) { chainsawSoundEffectInstance.Stop(); } if (survivorSprite.Ammunition.GasolineInCurrentCan < 0.0f && chainsawSoundEffectInstance.State == SoundState.Playing) { chainsawSoundEffectInstance.Stop(); } if (reload) { survivorSprite.Ammunition.ReloadGasolineCan(); } }
public static void LoadContent(ContentManager contentManager) { SurvivorSprite.LoadContent(contentManager); }
public override void Update(GameTime gameTime, Boolean leftFireValue, Boolean rightFireValue, Boolean reload, SurvivorSprite survivorSprite) { if (rightFireValue && survivorSprite.Ammunition.GasolineInCurrentCan > 0.0f) { AttackResults attackResults = survivorSprite.PerformMeleeAttack(DamageValue); if (attackResults == AttackResults.Kill) { survivorSprite.Game.Results.ChainsawWeaponResults.UsageResultingInKills++; survivorSprite.Game.Results.KillResults.ChainsawKills++; } else if (attackResults == AttackResults.Damage) { survivorSprite.Game.Results.ChainsawWeaponResults.UsageResultingInDamage++; } else { survivorSprite.Game.Results.ChainsawWeaponResults.UsageResultingInNoDamage++; } survivorSprite.Ammunition.GasolineInCurrentCan -= GASOLINE_USAGE_RATE; } if (rightFireValue && chainsawSoundEffectInstance.State != SoundState.Playing && survivorSprite.Ammunition.GasolineInCurrentCan > 0.0f) { chainsawSoundEffectInstance.Play(); } else if (!rightFireValue) { chainsawSoundEffectInstance.Stop(); } if (survivorSprite.Ammunition.GasolineInCurrentCan < 0.0f && chainsawSoundEffectInstance.State == SoundState.Playing) { chainsawSoundEffectInstance.Stop(); } if (reload) survivorSprite.Ammunition.ReloadGasolineCan(); }
public override void Update(GameTime gameTime, Boolean leftFireValue, Boolean rightFireValue, Boolean reload, SurvivorSprite survivorSprite) { Int32 oldFistIndex = currentAnimationIndex; if (rightFireValue && currentAnimationIndex < (ANIMATED_CELL_INDICIES.Length - 1)) { currentAnimationIndex++; } else if (!rightFireValue && currentAnimationIndex > 0) { currentAnimationIndex--; } if (oldFistIndex != currentAnimationIndex && currentAnimationIndex == ATTACK_CELL_INDEX) { AttackResults attackResults = survivorSprite.PerformMeleeAttack(DamageValue); if (attackResults == AttackResults.Damage) { Sounds.GetSound("Weapons.Crowbar.Hit").Play(); // survivorCrowbarHitSoundEffect.Play(); survivorSprite.Game.Results.CrowbarWeaponResults.UsageResultingInDamage++; } else if (attackResults == AttackResults.Kill) { Sounds.GetSound("Weapons.Crowbar.Hit").Play(); // survivorCrowbarHitSoundEffect.Play(); survivorSprite.Game.Results.CrowbarWeaponResults.UsageResultingInKills++; survivorSprite.Game.Results.KillResults.CrowbarHitKills++; } else { survivorSprite.Game.Results.CrowbarWeaponResults.UsageResultingInNoDamage++; } survivorSprite.CurrentStamina -= STAMINA_LOSS_VALUE; } }
public override void Update(GameTime gameTime, Boolean leftFireValue, Boolean rightFireValue, Boolean reload, SurvivorSprite survivorSprite) { delayTimer -= gameTime.ElapsedGameTime.TotalSeconds; if (reloading) { if (delayTimer <= 0.0) { reloadCounter--; if (reloadCounter < 0) { reloading = false; } else { delayTimer = DELAY_BETWEEN_RELOADS; //shotgunReloadSoundEffect.Play(); Sounds.GetSound("Weapons.Shotgun.Reload").Play(); } } } else { if (!fired && rightFireValue && delayTimer <= 0.0) { if (survivorSprite.Ammunition.ShotgunShellsInMagazine > 0) { survivorSprite.Ammunition.ShotgunShellsInMagazine--; //shotgunBlastSoundEffect.Play(); Sounds.GetSound("Weapons.Shotgun.Blast").Play(); this.delayTimer = DELAY_BETWEEN_SHOTS; this.Attack(survivorSprite); } else if (!survivorSprite.Game.Options.AutoReload || survivorSprite.Ammunition.ShotgunShellsTotal == 0) { //shotgunEmptySoundEffect.Play(); Sounds.GetSound("Weapons.Shotgun.Empty").Play(); this.delayTimer = DELAY_BETWEEN_SHOTS; } fired = true; } else if (!rightFireValue) { fired = false; } if (reload || (survivorSprite.Ammunition.ShotgunShellsInMagazine == 0 && survivorSprite.Game.Options.AutoReload)) { Int32 reloadCount = survivorSprite.Ammunition.ReloadShotgunMagazine(); if (reloadCount > 0) { reloading = true; reloadCounter = reloadCount - 1; delayTimer = DELAY_BETWEEN_RELOADS; //shotgunReloadSoundEffect.Play(); Sounds.GetSound("Weapons.Shotgun.Reload").Play(); } } } }
public abstract void Update(GameTime gameTime, Boolean leftFireValue, Boolean rightFireValue, Boolean reload, SurvivorSprite survivorSprite);
public override void Update(GameTime gameTime, Boolean leftFireValue, Boolean rightFireValue, Boolean reload, SurvivorSprite survivorSprite) { delayTimer -= gameTime.ElapsedGameTime.TotalSeconds; if (!fired && rightFireValue && delayTimer <= 0.0) { if (survivorSprite.Ammunition.PistolRoundsInCurrentClip > 0) { survivorSprite.Ammunition.PistolRoundsInCurrentClip--; //pistolShotSoundEffect.Play(); Sounds.GetSound("Weapons.Pistol.Shot").Play(); this.Attack(survivorSprite); } else if (!survivorSprite.Game.Options.AutoReload || survivorSprite.Ammunition.PistolRoundsTotal == 0) { //pistolEmptySoundEffect.Play(); Sounds.GetSound("Weapons.Pistol.Empty").Play(); } fired = true; delayTimer = DELAY_BETWEEN_SHOTS; } else if (!rightFireValue) { fired = false; if (reload || (survivorSprite.Ammunition.PistolRoundsInCurrentClip == 0 && survivorSprite.Game.Options.AutoReload) && delayTimer <= 0.0) { if (survivorSprite.Ammunition.ReloadPistolClip()) { //pistolReloadSoundEffect.Play(); Sounds.GetSound("Weapons.Pistol.Reload").Play(); delayTimer = DELAY_BETWEEN_RELOAD_AND_SHOTS; } } } }
public override void Update(GameTime gameTime, Boolean leftFireValue, Boolean rightFireValue, Boolean reload, SurvivorSprite survivorSprite) { Int32 oldFistIndex = currentAnimationIndex; if (rightFireValue && currentAnimationIndex < (ANIMATED_CELL_INDICIES.Length - 1)) { currentAnimationIndex++; } else if (!rightFireValue && currentAnimationIndex > 0) { currentAnimationIndex--; } if (oldFistIndex != currentAnimationIndex && currentAnimationIndex == ATTACK_CELL_INDEX) { AttackResults attackResults = survivorSprite.PerformMeleeAttack(DamageValue); if (attackResults == AttackResults.Damage) { Sounds.GetSound("Weapons.Fist.Punch").Play(); survivorSprite.Game.Results.FistWeaponResults.UsageResultingInDamage++; } else if (attackResults == AttackResults.Kill) { Sounds.GetSound("Weapons.Fist.Punch").Play(); survivorSprite.Game.Results.FistWeaponResults.UsageResultingInKills++; survivorSprite.Game.Results.KillResults.FistPunchKills++; } else { survivorSprite.Game.Results.FistWeaponResults.UsageResultingInNoDamage++; } survivorSprite.CurrentStamina -= STAMINA_LOSS_VALUE; } }