예제 #1
0
파일: Ghost.cpp 프로젝트: tmandry/adage
void Ghost::updateEvent(double secsElapsed)
{
	if (!mTarget) newTarget();

	//check if we caught them
	if (mTarget && distanceSq(pos(), mTarget->pos()) < 9.0) {
		mTarget->remove();

		Ghost* victim = new Ghost(mTarget->pos(), world());
		victim->setVelocity(mTarget->velocity());

		++mKillCount;
		if (mKillCount % 3 == 0) new DormantGhostPortal(pos(), world());

		newTarget();
	}

	newTargetTimer += secsElapsed;
	if (newTargetTimer > 30) newTarget();

	assert(mTarget || !(mPursue->isOn()));
	Actor::updateEvent(secsElapsed);
}