How can i divide points based on highest damage? For e.g i have monster which drop 50 experience points and 4 different players has dealt damage to this monster. But i will like to split the experience points based on the players damage.
So far i got this:
private Dictionary<Player, int> damageMap = new Dictionary<Player, int>();
public void TakeDamage(Player attacker, int damage)
{
damageMap.Add(attacker, damage);
}
private void OnDeath()
{
foreach (KeyValuePair<Player, int> entry in damageMap)
{
Player player = entry.Key;
int damage = entry.Value;
player.addExperience(50);
}
}