I have the code:
foreach(var o in objects)
{
o.Update(time);
if(o is Portal)
{
var a = (Portal)o;
a.Interact(ref player, player.Interact);
}
else if(o is Enemy)
{
var e = (Enemy)o;
e.Update(time, player);
}
}
I don't know if anything like this is possible?
I want to do it in one line. This is what I have in mind:
(Enemy)o => Update(time, player);
I know it's stupid but I want something similar. The method that has player as a parameter is unique to the Enemy object. I have to parse to call it.