State.cpp 929 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2014, Oculus VR, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. #include "RakAssert.h"
  11. #include "State.h"
  12. State::State()
  13. {
  14. fsmRefCount=0;
  15. }
  16. State::~State()
  17. {
  18. }
  19. void State::OnEnter(const FSM *caller, bool loadResources)
  20. {
  21. }
  22. void State::OnLeave(const FSM *caller, bool unloadResources)
  23. {
  24. }
  25. void State::FSMAddRef(const FSM *caller)
  26. {
  27. ++fsmRefCount;
  28. }
  29. void State::FSMRemoveRef(const FSM *caller)
  30. {
  31. RakAssert(fsmRefCount!=0);
  32. --fsmRefCount;
  33. }
  34. unsigned State::FSMRefCount(void) const
  35. {
  36. return fsmRefCount;
  37. }
  38. void ManagedState::FSMRemoveRef(const FSM *caller)
  39. {
  40. RakAssert(fsmRefCount!=0);
  41. if (--fsmRefCount)
  42. delete this;
  43. }
粤ICP备19079148号