Ejemplo n.º 1
0
void BlueBoom::draw()
{
	if (!isTouchable())
	{
		(*_sprites)->drawImage(getPosition(), nullptr, SCALE_NO, TRANSLATE_NO, DrawCenter::CENTER, _currentAngle);
	}
}
/**
 * Template method that returns whether the particles should be tranformed.
 *
 * Particles are only transformed if they are dirty and either visible or touchable.
 * If the bounding volume is fixed, and the emitter is not in the camera's field of view,
 * then the particles are not transformed.
 * 
 * Subclasses may override this methods to change how this decision is made.
 */
bool CC3MeshParticleEmitter::shouldTransformParticles( CC3NodeUpdatingVisitor* visitor )
{
	if ( !isParticleTransformDirty() ) 
		return false;

	if ( !(isVisible() || isTouchable()) )
		return false;

	if ( (shouldUseFixedBoundingVolume() || !shouldTransformUnseenParticles()) &&
		!(doesIntersectFrustum( visitor->getCamera()->getFrustum())) )
		return false;

	return true;
}
Ejemplo n.º 3
0
bool Tile::affect(Object* obj, DWORD key, TileType collisLevel)
{
	if ((this->isWater() && !CHECK_KEY(key, KEY_WATER_COLLIS)) || _type < collisLevel)
		return false;

	if (CHECK_KEY(key, KEY_MOVEABLE))
	{
		double time = 0;
		Direction direct = Direction::NONE;

		if (isTouchable())
			time = Collision::checkCollision(obj, this, &direct);

		if (direct != Direction::NONE) { // If the object touched this tile.
			if (getType() >= TouchLevel::FOUR_FACE || direct == Direction::UP) // If tile is touchable at any direction or the touch side is top of tile
				if (time <= Timer::getRoundTime() && time >= 0) // If this collision happened sooner than current result, replace it, then.
				{
				if (time == 0)
				{
					switch (direct)
					{
					case UP:	if (obj->getRect().bottom < this->getRect().top)	return false; break;
					case DOWN:	if (obj->getRect().top > this->getRect().bottom)	return false; break;
					case LEFT:	if (obj->getRect().right > this->getRect().left)	return false; break;
					case RIGHT:	if (obj->getRect().left < this->getRect().right)	return false; break;
					default: break;
					}
				}

				MoveObject *moveObject = dynamic_cast<MoveObject *>(obj);
				moveObject->pushCollisEvent(new CollisEvent(this, direct, time));
				return true;
				}
		}
	}

	return false;
}