So, essentially, I have a list of the class “effect”, and want to get all of those that is of the inheriting type “SkillBonusEffect”. So I did this:
public List<EffectSkillBonus> getSkillEffects() {
List<EffectSkillBonus> output = new List<EffectSkillBonus>();
foreach(var effect in this.Effects) {
if (effect.GetType() == typeof(EffectSkillBonus)) {
output.Add(effect);
}
}
return output;
}
But, it understandably, gives me the error:
Argument 1: cannot convert from 'Effect' to 'EffectSkillBonus'
What is the best way to do this?
It is important that it returns a list of EffectSkillBonus
.