private Vector2 ResolveCollision(ICollidable moving, ICollidable stationary)
{
if (moving.Bounds.Intersects(stationary.Bounds))
{
if (moving is Player)
{
(Player)moving.Color = Color.Red;
}
}
// ...
}
I have a class Player
that implements ICollidable
. For debugging purposes I'm just trying to pass a bunch of ICollidables
to this method and do some special stuff when it's the player. However when I try to do the cast to Player
of the ICollidable
I get an error telling me that ICollidable
doesn't have a Color
property.
Am I not able to make a cast this way or am I doing something wrong?