I have a list of "traps" in my main class. In the subclass "Flame" I want to delete certain elements from that list. The problem is, how do I select these elements? Trap does have other sublasses with different attributes.
This is what I got so far (code simplified, from "Flame.cs"):
public override Boolean collide()
{
var flames = form1.traps.Where(trap => trap.ID == ID);
foreach (Flame f in flames)
{
if (f.pos > pos)
{
form1.traps.Remove(f);
}
}
return true;
}
I feel like I should know this, but atm I'm stuck :/