VisibilityBlocker.py 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. """VisibilityBlocker module: contains the VisibilityBlocker class"""
  2. import Entity
  3. class VisibilityBlocker:
  4. """This is a mixin class for level entities (see Entity.py) that in some
  5. way 'block' visibility (such as doors) -- entities that can completely
  6. obscure what's behind them. It provides the blocker with a mechanism
  7. whereby they are informed of when it is safe for them to 'unblock' the
  8. visibility and show what's behind them. Without this mechanism, the
  9. blocker might show what's behind it before all of the distributed objects
  10. behind it have been generated."""
  11. def __init__(self):
  12. # this may do something in the future; please call down to it
  13. pass
  14. def destroy(self):
  15. self.ignoreAll()
  16. def requestUnblockVis(self):
  17. """derived class should call this before the end of the frame in which
  18. they cause the visibility to be extended. okToUnblockVis (see below)
  19. will be called when it's safe to show the new zones."""
  20. self.accept(self.level.tcr.getNextSetZoneDoneEvent(),
  21. self.okToUnblockVis)
  22. def okToUnblockVis(self):
  23. """derived class should override this func and do the vis unblock
  24. (i.e. open the door, etc.)"""
  25. # this may do something in the future; please call down to it
  26. pass