openablebehaviour.c 397 B

12345678910111213141516171819202122232425262728293031323334
  1. class OpenableBehaviour
  2. {
  3. protected bool m_IsOpened;
  4. void OpenableBehaviour(bool bState = true)
  5. {
  6. m_IsOpened = bState; //! initial value
  7. }
  8. void Open()
  9. {
  10. SetState(true);
  11. }
  12. void Close()
  13. {
  14. SetState(false);
  15. }
  16. bool IsOpened()
  17. {
  18. return GetState();
  19. }
  20. protected void SetState(bool bState)
  21. {
  22. m_IsOpened = bState;
  23. }
  24. protected bool GetState()
  25. {
  26. return m_IsOpened;
  27. }
  28. }