AIStupidEngine Class Reference

#include <ai_engine_stupid.h>

Collaboration diagram for AIStupidEngine:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void Refresh ()

Static Public Member Functions

static AIStupidEngineGetInstance ()

Private Member Functions

 AIStupidEngine ()
void BeginTurn ()
void ChooseDirection ()

Private Attributes

AIMovementModule m_movement
AIShootModule m_shoot
Characterm_last_char
Characterm_enemy
uint m_begin_turn_time
uint m_step
uint m_current_time

Static Private Attributes

static AIStupidEnginesingleton = NULL

Detailed Description

Definition at line 29 of file ai_engine_stupid.h.


Constructor & Destructor Documentation

AIStupidEngine::AIStupidEngine (  )  [private]

Definition at line 39 of file ai_engine_stupid.cpp.

00040 {
00041   std::cout << "o Artificial Intelligence Stupid engine initialization" << std::endl;
00042 }

Here is the caller graph for this function:


Member Function Documentation

void AIStupidEngine::BeginTurn (  )  [private]

Definition at line 54 of file ai_engine_stupid.cpp.

00055 {
00056   m_last_char = &ActiveCharacter();
00057   m_enemy = NULL;
00058 
00059   m_begin_turn_time = 0;
00060   m_step = 0;
00061 
00062   m_movement.BeginTurn();
00063   m_shoot.BeginTurn();
00064 }

Here is the call graph for this function:

Here is the caller graph for this function:

void AIStupidEngine::ChooseDirection (  )  [private]

AIStupidEngine * AIStupidEngine::GetInstance (  )  [static]

Definition at line 44 of file ai_engine_stupid.cpp.

00045 {
00046   if (singleton == NULL)
00047     singleton = new AIStupidEngine();
00048 
00049   return singleton;
00050 }

Here is the call graph for this function:

Here is the caller graph for this function:

void AIStupidEngine::Refresh (  ) 

Definition at line 66 of file ai_engine_stupid.cpp.

00067 {
00068   if (ActiveCharacter().IsDead())
00069     return;
00070 
00071   // new character to control
00072   if (&ActiveCharacter() != m_last_char) {
00073     BeginTurn();
00074   }
00075 
00076   // Get time
00077   uint local_time = Time::GetInstance()->ReadSec();
00078   if (local_time != m_current_time) {
00079     m_current_time = local_time;
00080   }
00081 
00082   // wait some seconds as if we are thinking...
00083   if (m_current_time < m_begin_turn_time + 3)
00084     return;
00085 
00086   if (m_shoot.Refresh(m_current_time)) {
00087     m_movement.Move(m_current_time);
00088   }
00089 
00090 //   switch (m_step)
00091 //     {
00092 //     case 0:
00093 //       if (m_nearest_enemy) {
00094 //      // we already knows who to shoot
00095 //      m_step = 1;
00096 //       } else {
00097 //      m_movement.Move(m_current_time);
00098 //       }
00099 //       break;
00100 //     case 1:
00101 //       // shoot !!
00102 //       m_shoot.Shoot(m_current_time);
00103 //       break;
00104 //     case 2:
00105 //       // go go go !!
00106 //       ChooseDirection();
00107 //       m_step++;
00108 //       break;
00109 //     case 3:
00110 //       m_movement.Move(m_current_time);
00111 //       break;
00112 //     case 4:
00113 //       // Wait for end of turn
00114 //       break;
00115 //     default:
00116 //       assert(false);
00117 //     }
00118 
00119 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

uint AIStupidEngine::m_begin_turn_time [private]

Definition at line 42 of file ai_engine_stupid.h.

uint AIStupidEngine::m_current_time [private]

Definition at line 45 of file ai_engine_stupid.h.

Character* AIStupidEngine::m_enemy [private]

Definition at line 40 of file ai_engine_stupid.h.

Character* AIStupidEngine::m_last_char [private]

Definition at line 39 of file ai_engine_stupid.h.

AIMovementModule AIStupidEngine::m_movement [private]

Definition at line 36 of file ai_engine_stupid.h.

AIShootModule AIStupidEngine::m_shoot [private]

Definition at line 37 of file ai_engine_stupid.h.

uint AIStupidEngine::m_step [private]

Definition at line 43 of file ai_engine_stupid.h.

AIStupidEngine * AIStupidEngine::singleton = NULL [static, private]

Definition at line 33 of file ai_engine_stupid.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:34:06 2007 for Wormux by  doxygen 1.4.7