} // not everybody can shoot -- it needs skills protected void TakeTheShot(WesternMan enemy, Action haveSomethingToSay = null, bool deathshot = false) { if (Health.State == HealthState.Killed) { throw new CantShootException(); } if ((!enemy._shooters.Contains(this)) && haveSomethingToSay != null) { haveSomethingToSay.Invoke(); } else { if (enemy.Health.State != HealthState.Killed) // already dead { if (deathshot) // instant kill (Wasted) { enemy.Health = new Killed(); } else // update health bar { enemy.Health.SetNextState(enemy); } } } // update shooters health .. if (!enemy._shooters.Contains(this)) { enemy._shooters.Add(this); } if (enemy.Health.State == HealthState.Killed) { enemy.KilledBy = this; } }
public virtual void Shoot(WesternMan enemy) => TakeTheShot(enemy);