AIState.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #include "AIState.h"
  9. #include "AIComponent.h"
  10. #include <SDL/SDL_log.h>
  11. void AIPatrol::Update(float deltaTime)
  12. {
  13. SDL_Log("Updating %s state", GetName());
  14. bool dead = true;
  15. if (dead)
  16. {
  17. mOwner->ChangeState("Death");
  18. }
  19. }
  20. void AIPatrol::OnEnter()
  21. {
  22. SDL_Log("Entering %s state", GetName());
  23. }
  24. void AIPatrol::OnExit()
  25. {
  26. SDL_Log("Exiting %s state", GetName());
  27. }
  28. void AIDeath::Update(float deltaTime)
  29. {
  30. SDL_Log("Updating %s state", GetName());
  31. }
  32. void AIDeath::OnEnter()
  33. {
  34. SDL_Log("Entering %s state", GetName());
  35. }
  36. void AIDeath::OnExit()
  37. {
  38. SDL_Log("Exiting %s state", GetName());
  39. }
  40. void AIAttack::Update(float deltaTime)
  41. {
  42. SDL_Log("Updating %s state", GetName());
  43. }
  44. void AIAttack::OnEnter()
  45. {
  46. SDL_Log("Entering %s state", GetName());
  47. }
  48. void AIAttack::OnExit()
  49. {
  50. SDL_Log("Exiting %s state", GetName());
  51. }