Refactor the common behavior of all engines in an abstract class (enter and leave background environment).