This commit is contained in:
parent
731ac49770
commit
d5ca17cc3b
7 changed files with 300 additions and 2 deletions
|
@ -68,6 +68,20 @@ void CNpcFlyingDutchmanEnemy::postInit()
|
|||
}
|
||||
|
||||
m_fireCount = 0;
|
||||
|
||||
m_invulnerableTimer = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcFlyingDutchmanEnemy::think( int _frames )
|
||||
{
|
||||
if ( m_invulnerableTimer > 0 )
|
||||
{
|
||||
m_invulnerableTimer -= _frames;
|
||||
}
|
||||
|
||||
CNpcEnemy::think( _frames );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -325,6 +339,8 @@ void CNpcFlyingDutchmanEnemy::processShot( int _frames )
|
|||
|
||||
case NPC_GENERIC_HIT_RECOIL:
|
||||
{
|
||||
m_invulnerableTimer = 2 * GameState::getOneSecondInFrames();
|
||||
|
||||
if ( !m_animPlaying )
|
||||
{
|
||||
m_state = 0;
|
||||
|
@ -447,3 +463,89 @@ void CNpcFlyingDutchmanEnemy::render()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcFlyingDutchmanEnemy::collidedWith(CThing *_thisThing)
|
||||
{
|
||||
if ( m_isActive && !m_isCaught && !m_isDying )
|
||||
{
|
||||
switch(_thisThing->getThingType())
|
||||
{
|
||||
case TYPE_PLAYER:
|
||||
{
|
||||
CPlayer *player = (CPlayer *) _thisThing;
|
||||
|
||||
ATTACK_STATE playerState = player->getAttackState();
|
||||
|
||||
if(playerState==ATTACK_STATE__NONE)
|
||||
{
|
||||
if ( !player->isRecoveringFromHit() )
|
||||
{
|
||||
switch( m_data[m_type].detectCollision )
|
||||
{
|
||||
case DETECT_NO_COLLISION:
|
||||
{
|
||||
// ignore
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DETECT_ALL_COLLISION:
|
||||
{
|
||||
m_oldControlFunc = m_controlFunc;
|
||||
m_controlFunc = NPC_CONTROL_COLLISION;
|
||||
|
||||
processUserCollision( _thisThing );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DETECT_ATTACK_COLLISION_GENERIC:
|
||||
{
|
||||
processAttackCollision();
|
||||
processUserCollision( _thisThing );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( m_invulnerableTimer <= 0 )
|
||||
{
|
||||
// player is attacking, respond appropriately
|
||||
|
||||
if ( m_controlFunc != NPC_CONTROL_SHOT )
|
||||
{
|
||||
if(playerState==ATTACK_STATE__BUTT_BOUNCE)
|
||||
{
|
||||
player->justButtBouncedABadGuy();
|
||||
}
|
||||
m_controlFunc = NPC_CONTROL_SHOT;
|
||||
m_state = NPC_GENERIC_HIT_CHECK_HEALTH;
|
||||
|
||||
drawAttackEffect();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TYPE_ENEMY:
|
||||
{
|
||||
CNpcEnemy *enemy = (CNpcEnemy *) _thisThing;
|
||||
|
||||
if ( canCollideWithEnemy() && enemy->canCollideWithEnemy() )
|
||||
{
|
||||
processEnemyCollision( _thisThing );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue