Ejemplo n.º 1
0
void GeoScene::Update(int timeScale)
{
	//update hands
	GeoParticle* gp;
	GeoHands* gh;
	for (vector<Particle*>::iterator h = pHandPositions->begin(); h != pHandPositions->end(); ++h)
	{
		gh= (GeoHands*)(*h);

		for (vector<Particle*>::iterator p = pPeople->begin(); p != pPeople->end(); ++p)
		{
			gp = (GeoParticle*)(*p);
			if(gp->m_isExploding) continue;

			if ((*h)->pos.x + radius > ((*p)->pos.x ) && (*h)->pos.x - radius<((*p)->pos.x ))
			{
				if ((*h)->pos.y -50 + radius >((*p)->pos.y  ) && (*h)->pos.y - radius < ((*p)->pos.y))
				{
					

					//gp->vel.x = gp->vel.x /2 ;
					gp->countDown(timeScale);
					onTarget = true;
					gh->handCountDown(timeScale, onTarget);	

					if( gp->m_isDead){
						pPeople->erase(p, p);
					}

					goto stopSearching;
				}
			}
			


		}

	}

	stopSearching:

	//update geo particles
	for (vector<Particle*>::iterator p = pPeople->begin(); p != pPeople->end(); ++p)
	{
		gp = (GeoParticle*)(*p);
		gp->update(timeScale);
		
	}	

}
Ejemplo n.º 2
0
void GeoScene::Update(int deltaTime)
{
	GeoParticle* gp;
	GeoHands* gh;
	for (vector<Particle*>::iterator h = pHandPositions->begin(); h != pHandPositions->end(); ++h)
	{
		gh= (GeoHands*)(*h);

		for (vector<Particle*>::iterator p = pPeople->begin(); p != pPeople->end(); ++p)
		{
			gp = (GeoParticle*)(*p);
			
			
			if ((*h)->pos.x + radius > ((*p)->pos.x ) && (*h)->pos.x - radius<((*p)->pos.x ))
			{
				if ((*h)->pos.y -50 + radius >((*p)->pos.y  ) && (*h)->pos.y - radius < ((*p)->pos.y))
				{
					
					gp->vel.x = 1 ;
					gp->countDown(deltaTime);
					onTarget = true;
					gh->handCountDown(deltaTime, onTarget);	
					
				}
			}
			else{
				(*p)->vel.x = ofRandom(3,4);
				col = ofColor(255, 255, 255);
				radius = 100;
				onTarget = false;
			//	gh->handCountDown(deltaTime,onTarget);
					


			}
		}

	}

}