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