39 fp->readBool(&_bJumpy);
40 fp->readBool(&_bTrapSenitive);
43 void aiMobState_Ramble::perceive_active( std::string strID_Old )
48 pMonster->getPivot()-> bSimulateGravitation = M_TRUE;
50 pMonster->_fxTrail.enable();
53 void aiMobState_Ramble::perceive_inactive( std::string strID_New )
57 aiMobState_Ramble::~aiMobState_Ramble(
void)
63 void aiMobState_Ramble::perceive_InTerritory(
unsigned state)
73 void aiMobState_Ramble::perceive_InRange(
unsigned state)
81 _select_creature( M_TRUE );
85 _select_creature( M_FALSE );
89 pPlayer->ctlBattleMode();
96 void aiMobState_Ramble::perceive(
unsigned state, M_BOOL global,
unsigned id, aiPerceptData data)
105 int direction = pMonster->getMoveDirection();
106 pMonster->move( this->_update_direction( direction ) );
108 aiMobState::perceive(state, global,
id, data);
113 int aiMobState_Ramble::_update_direction(
int dir)
117 if( _chasm_infront() )
121 else if( _obstacle_infront() )
123 if( _obstacle_above() || (!_bJumpy) )
132 if( !_within_left_range() )
135 if( !_within_right_range() )
141 M_BOOL aiMobState_Ramble::_obstacle_infront()
144 laPivot *pMobPivot = pMonster->getPivot();
146 int direction = pMonster->getMoveDirection();
147 laPoint3 vTentacle(direction*
M_UNIT*2, 0, 0);
150 vPivot[1] -=
M_UNIT * 0.3;
151 vTentacle = vPivot.projectVector(vTentacle);
153 if( vTentacle.lenght() <= (vPivot.size.x()*0.5 +
M_UNIT*0.15) )
return M_TRUE;
157 M_BOOL aiMobState_Ramble::_obstacle_above()
160 laPivot *pMobPivot = pMonster->getPivot();
162 int direction = pMonster->getMoveDirection();
163 laPoint3 vTentacle(direction*
M_UNIT, 0, 0);
166 vPivot[1] -=
M_UNIT * 1.5;
167 vTentacle = vPivot.projectVector(vTentacle);
169 if( vTentacle.lenght() <=
M_UNIT*0.5 )
return M_TRUE;
173 M_BOOL aiMobState_Ramble::_chasm_infront()
176 laPivot *pMobPivot = pMonster->getPivot();
178 int direction = pMonster->getMoveDirection();
179 laPoint3 vTentacle(0, +3*
M_UNIT, 0);
181 M_BOOL bTrap = M_FALSE;
183 vPivot[0] += direction * vPivot.size.x()*0.2;
184 vTentacle = vPivot.projectVector(vTentacle, &bTrap);
186 if( (bTrap && _bTrapSenitive) || (vTentacle.lenght() >=
M_UNIT*1.2) )
return M_TRUE;
#define M_UNIT
Unit of 1 meter.
Adds capabilities and percepts specific to monster creatures.