public MarioBlockCollisionHandler(CollisionData collision) { this.collision = collision; collisionSide = (ICollisionSide)collision.CollisionSide; if (collision.GameObjectA is IMario) { collidingMario = (IMario)collision.GameObjectA; collidingBlock = (Block)collision.GameObjectB; } else { collidingMario = (IMario)collision.GameObjectB; collidingBlock = (Block)collision.GameObjectA; collisionSide = collisionSide.FlipSide(); } }
public ItemBlockCollisionHandler(CollisionData collision) { this.collision = collision; side = collision.CollisionSide; if (collision.GameObjectA is IItem) { collidingItem = (IItem)collision.GameObjectA; collidingBlock = (Block)collision.GameObjectB; } else { collidingBlock = (Block)collision.GameObjectA; collidingItem = (IItem)collision.GameObjectB; side = side.FlipSide(); } }