|
@@ -10,6 +10,9 @@ AIState* AIState::_empty = NULL;
|
|
|
AIState::AIState(const char* id)
|
|
AIState::AIState(const char* id)
|
|
|
: _id(id), _listener(NULL)
|
|
: _id(id), _listener(NULL)
|
|
|
{
|
|
{
|
|
|
|
|
+ addEvent("enter", "<AIAgent><AIState>");
|
|
|
|
|
+ addEvent("exit", "<AIAgent><AIState>");
|
|
|
|
|
+ addEvent("update", "<AIAgent><AIState>f");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
AIState::~AIState()
|
|
AIState::~AIState()
|
|
@@ -36,7 +39,7 @@ void AIState::enter(AIStateMachine* stateMachine)
|
|
|
if (_listener)
|
|
if (_listener)
|
|
|
_listener->stateEnter(stateMachine->getAgent(), this);
|
|
_listener->stateEnter(stateMachine->getAgent(), this);
|
|
|
|
|
|
|
|
- // TODO: Fire script event
|
|
|
|
|
|
|
+ fireEvent<void>("enter", stateMachine->getAgent(), this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void AIState::exit(AIStateMachine* stateMachine)
|
|
void AIState::exit(AIStateMachine* stateMachine)
|
|
@@ -44,7 +47,7 @@ void AIState::exit(AIStateMachine* stateMachine)
|
|
|
if (_listener)
|
|
if (_listener)
|
|
|
_listener->stateExit(stateMachine->getAgent(), this);
|
|
_listener->stateExit(stateMachine->getAgent(), this);
|
|
|
|
|
|
|
|
- // TODO: Fire script event
|
|
|
|
|
|
|
+ fireEvent<void>("exit", stateMachine->getAgent(), this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void AIState::update(AIStateMachine* stateMachine, float elapsedTime)
|
|
void AIState::update(AIStateMachine* stateMachine, float elapsedTime)
|
|
@@ -52,7 +55,7 @@ void AIState::update(AIStateMachine* stateMachine, float elapsedTime)
|
|
|
if (_listener)
|
|
if (_listener)
|
|
|
_listener->stateUpdate(stateMachine->getAgent(), this, elapsedTime);
|
|
_listener->stateUpdate(stateMachine->getAgent(), this, elapsedTime);
|
|
|
|
|
|
|
|
- // TODO: Fire script event
|
|
|
|
|
|
|
+ fireEvent<void>("update", stateMachine->getAgent(), this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
AIState::Listener::~Listener()
|
|
AIState::Listener::~Listener()
|