コード例 #1
0
        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;
            }
        }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
 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();
 }