blob: 79b1a766bfb60e633988df20e154035da4342562 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "zoneaffector.h"
#include <QDebug>
ZoneAffector::ZoneAffector(QObject *parent) :
ParticleAffector(parent), m_x(0), m_y(0), m_width(0), m_height(0), m_affector(0)
{
}
bool ZoneAffector::affect(ParticleData *d, qreal dt)
{
if(!m_affector)
return false;
qreal x = d->curX();
qreal y = d->curY();
if(x >= m_x && x <= m_x+m_width && y >= m_y && y <= m_y+m_height)
return m_affector->affect(d, dt);
return false;
}
void ZoneAffector::reset(int systemIdx)
{
if(m_affector)
m_affector->reset(systemIdx);
}
QT_END_NAMESPACE
|