Advertisement
Guest User

Untitled

a guest
Feb 7th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. class Entity : public Engine
  2. {
  3.     protected:
  4.         //…
  5.     public:
  6.         //…
  7.         virtual void Physics()
  8.         {
  9.             //Default physics.//
  10.         }
  11.         virtual void Other(){}//Could be used for AI.
  12. };
  13. struct DefaultAI
  14. {
  15.     void AIDefault()
  16.     {
  17.         //Default AI behavior.//
  18.     }
  19. };
  20. class FirstAI: public Entity, public DefaultAI
  21. {
  22.     //…
  23.     public:
  24.         //…
  25.         void Other()
  26.         {
  27.             //The AI most of the AI’s would have.
  28.             Default();
  29.         }
  30. };
  31. class SecondAI: public Entity
  32. {
  33.    //…
  34. public:
  35.    //…
  36.    void Other()
  37.    {
  38.       //New AI behavior.//
  39.    }
  40.    void Physics()
  41.    {
  42.       //New physics.//
  43.    }
  44. };
  45. //Could be in the singleton.//
  46. static void Shared( Entity *ent )
  47. {
  48.    ent->Physics();
  49.    ent->Other();
  50. }
  51. class Single
  52. {
  53.     std::vector objects;
  54.     public:
  55.         void Instantiate( std::string what )
  56.         {
  57.             //…
  58.         }
  59.         void Update()
  60.         {
  61.              //Somewhere in the engines cycle.//
  62.              Shared( objects[i] );
  63.         }
  64. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement