Gerard-Meier

States

Mar 11th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #ifndef ENEMYSTATES_H
  2. #define ENEMYSTATES_H
  3.  
  4. #include "IEnemyState.h"
  5. #include "IdleState.h"
  6.  
  7. class EnemyStates {
  8.     public:
  9.         static IdleState Idle;
  10.  
  11. };
  12.  
  13.  
  14. #endif // ENEMYSTATES_H
  15.  
  16. ---------------------------
  17.  
  18. #ifndef IDLESTATE_H
  19. #define IDLESTATE_H
  20.  
  21. #include "IEnemyState.h"
  22.  
  23. class IdleState : public IEnemyState {
  24.     public:
  25.         virtual void apply() {
  26.             printf("idle state. !!!!!!!!!!!!!!\n");
  27.         }
  28. };
  29.  
  30. #endif //IDLESTATE_H
  31.  
  32.  
  33. ------------------------
  34.  
  35. #include "Enemy.h"
  36. #include "StarSystem.h"
  37. #include "Starship.h"
  38.  
  39.  
  40. #include "EnemyStates.h"
  41. #include "IdleState.h"
  42.  
  43. Enemy::Enemy(StarSystem* starSystem)
  44.     : Boid(starSystem),
  45.  
  46.     // Some default weights. Eventually we should create a nice factory for this.
  47.     _seperationBehaviour(10), _cohesionBehaviour(15), _alignmentBehaviour(20) {
  48.  
  49.     // Gives an error:
  50.     EnemyStates::Idle.apply();
  51.  
  52.     // [more code here.]
  53. }// [more code here.]
Advertisement
Add Comment
Please, Sign In to add comment