SBSPSS/source/platform/pretract.cpp

69 lines
1.3 KiB
C++
Raw Normal View History

2001-04-23 21:18:06 +02:00
/*=========================================================================
pretract.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PLATFORM_PRETRACT_H__
#include "platform\pretract.h"
#endif
2001-04-23 22:40:13 +02:00
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
2001-04-23 21:18:06 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRetractingPlatform::postInit()
{
2001-05-05 15:54:34 +02:00
CNpcPlatform::postInit();
2001-04-23 21:18:06 +02:00
m_timer = NPC_PLATFORM_TIMER_RETRACT;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRetractingPlatform::processTimer( int _frames )
{
switch( m_timerType )
{
case NPC_PLATFORM_TIMER_RETRACT:
{
if ( m_timer > 0 )
{
m_timer -= _frames;
}
else
{
m_timer = 4 * GameState::getOneSecondInFrames();
m_timerType = NPC_PLATFORM_TIMER_EXTEND;
m_detectCollision = false;
}
break;
}
case NPC_PLATFORM_TIMER_EXTEND:
{
if ( m_timer > 0 )
{
m_timer -= _frames;
}
else
{
m_timer = 4 * GameState::getOneSecondInFrames();
m_timerType = NPC_PLATFORM_TIMER_RETRACT;
m_detectCollision = true;
}
break;
}
}
}