SBSPSS/source/triggers/tsswitch.cpp

87 lines
1.7 KiB
C++
Raw Normal View History

2001-06-06 14:43:37 +02:00
/*=========================================================================
tsswitch.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __TRIGGERS_TSSWITCH_H__
#include "triggers\tsswitch.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
2001-06-06 15:27:46 +02:00
#ifndef __ENEMY_NPC_H__
#include "enemy\npc.h"
#endif
2001-08-03 15:00:09 +02:00
#include "fx\fxsteam.h"
2001-06-06 14:43:37 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CSteamSwitchEmitterTrigger::setPositionAndSize(int _x,int _y,int _w,int _h)
{
CTrigger::setPositionAndSize( _x, _y, _w, _h );
m_effect = CFX::Create( CFX::FX_TYPE_STEAM, Pos );
2001-06-06 15:27:46 +02:00
m_active = true;
2001-08-03 15:00:09 +02:00
CFXSteam *steam = (CFXSteam *) m_effect;
DVECTOR velocity;
velocity.vx = 0;
velocity.vy = -1;
steam->SetVel( velocity );
2001-06-06 14:43:37 +02:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CSteamSwitchEmitterTrigger::toggleVisible()
{
2001-06-06 15:27:46 +02:00
m_active = !m_active;
2001-08-03 15:00:09 +02:00
CFXSteam *steam = (CFXSteam *) m_effect;
DVECTOR velocity;
velocity.vx = 0;
velocity.vy = -4 * m_active;
if ( m_active )
{
steam->SetSize( 4 * ONE );
}
else
{
steam->SetSize( ONE );
}
steam->SetVel( velocity );
2001-06-06 15:27:46 +02:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CSteamSwitchEmitterTrigger::collidedWith(CThing *_thisThing)
{
if ( m_active )
{
switch(_thisThing->getThingType())
{
case TYPE_ENEMY:
{
CNpcEnemy *enemy = (CNpcEnemy *) _thisThing;
enemy->hasBeenSteamed( Pos );
break;
}
default:
break;
}
}
2001-06-06 14:43:37 +02:00
}