Exemple #1
0
//================================================================================================//
void Bug::Update()
{
	iTakeDamageTicks--;
	if(!gpEngine->bRecording || (gpEngine->bRecording && gpEngine->pRecordEnt != this))
		PlayBack();

	oPos = Pos;
	InWater();

	if(KEY_RIGHT.state == PRESSED)
	{
		fRotation += 1.85f;
	}
	if(KEY_LEFT.state == PRESSED)
	{
		fRotation -= 1.85f;
	}

	Vec2 u,r;
	UTIL_Misc::MakeVectors(fRotation,u,r);
	Pos+=u*2.5f;

	fRotation = UTIL_Misc::Wrap(fRotation,360);
	frame<15? frame+=0.75f: frame=0;

	if(RateofFire>0)
	if(gpEngine->mTimer.GetTime()>=fLastFireTime+((float)RateofFire*gpEngine->fGameDifficulty))
	{
		fLastFireTime = gpEngine->mTimer.GetTime();
		Bullet b;
		b.pSpawn = Spawn_BasicBullet;
		b.pUpdate = Update_BasicBullet;
		b.pRender = Render_BasicBullet;
		b.pCollide = Collide_BasicBullet;
		Vec2 v;
		if(FireAtDistantTarget(mSphere.p,gpEngine->mPlayer.mSphere.p,3.5f,v))
		{
			(*b.pSpawn)(b,mSphere.p,v);
			gpEngine->SpawnBullet(b,false);
			SND_LASER2;
		}
	}
}
Exemple #2
0
MainFrame::MainFrame(void):QMainWindow(0)
{
	setupUi(this);
	displayMode = AIS_DisplayMode::AIS_WireFrame;
	this->setWindowIconText("AsmPlan");
	myViewer = new Viewer(this);
	myViewer->setFocus();

	setCentralWidget(myViewer);
	connect(actionEXIT, SIGNAL(triggered()),this,SLOT(Exit()));
	connect(actionSTEP, SIGNAL(triggered()),this,SLOT(ImportStep()));
	connect(actionABOUT, SIGNAL(triggered()),this,SLOT(about()));
	connect(actionSTEPBack, SIGNAL(triggered()),this,SLOT(StepBack()));
	connect(actionPlayBack, SIGNAL(triggered()),this,SLOT(PlayBack()));
	connect(actionStop, SIGNAL(triggered()),this,SLOT(Stop()));
	connect(actionNextStep, SIGNAL(triggered()),this,SLOT(NextStep()));
	connect(actionPlayFoward, SIGNAL(triggered()),this,SLOT(PlayFoward()));
	connect(actionFoto, SIGNAL(triggered()),this,SLOT(ExportPhoto()));
	connect(actionDBGShow, SIGNAL(triggered()),this,SLOT(DBGShow()));
	connect(myViewer, SIGNAL(contextMenuSignal(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
	connect(actionViewMode, SIGNAL(triggered()), this, SLOT(ViewModeChanged()));
	connect(action_AssemlyInfoRequest, SIGNAL(triggered()), this, SLOT(ShowAssemblyInfo()));
	connect(action_SetFrameDisplayMode, SIGNAL(triggered()), this, SLOT(SetWireFrameMode()));
	connect(action_SetShadedDisplayMode, SIGNAL(triggered()), this, SLOT(SetShadedMode()));
	connect(action_ShowFullProduct, SIGNAL(triggered()), this, SLOT(ShowFullProduct()));
	connect(action_HideDisassembled, SIGNAL(triggered()), this, SLOT(HideDisaasembledPart()));


	//Test panel functions
	connect(action_ContactTest, SIGNAL(triggered()), this, SLOT(TestContactSpotVerbose()));
	connect(action_PointOnFace, SIGNAL(triggered()), this, SLOT(TestPointOnPart()));
	connect(action_FaceTrait, SIGNAL(triggered()), this, SLOT(TestSpartialDesc()));
	connect(action_PartIso, SIGNAL(triggered()), this, SLOT(TestIsoFaceForPart()));
	connect(action_DBGTime, SIGNAL(triggered()), this, SLOT(TestDBGTime()));
	connect(actionPartGraph, SIGNAL(triggered()), this, SLOT(PartGraph()));
	connect(actionBodyDescriptor, SIGNAL(triggered()), this, SLOT(TestBodyDescriptor()));
	connect(action_VoxelGeneration, SIGNAL(triggered()), this, SLOT(TestVoxelGeneration()));

}
Exemple #3
0
//================================================================================================//
void Serpent::Update()
{
	iTakeDamageTicks--;
	if(!gpEngine->bRecording || (gpEngine->bRecording && gpEngine->pRecordEnt != this))
		PlayBack();

	if(IsHead)
		InWater();
	oPos = Pos;
	if(IsDead)
		return;

	if(KEY_RIGHT.state == PRESSED)
	{
		fRotation += 1.5f;
		frame+=0.075f;
	}
	if(KEY_LEFT.state == PRESSED)
	{
		fRotation -= 1.5f;
		frame-=0.075f;
	}
	fRotation = UTIL_Misc::Wrap(fRotation,360);

	if(KEY_UP.state == PRESSED)
	{
		Vec2 u,r;
		UTIL_Misc::MakeVectors(fRotation,u,r);
		Pos+=u*2.5f;
	}
	if(frame>15)
		frame-=15;
	else if(frame<0)
		frame+=15;

	vector<Serpent>::iterator iter;
	for(iter = mSections.begin(); iter < mSections.end(); iter++)
	{
		if((*iter).IsActive)
			(*iter).PreUpdate();
	}

	if(gpEngine->bRecording && gpEngine->pRecordEnt == this)
		return;
	iTickSection--;
	if((IsHead && iTickSection == 0) || (IsHead && iTickSection==7 && iCurSection == SERPENT_LENGTH))
	{
		if(iCurSection>0)
		{
			mSections[iCurSection-1].SpawnSection(StartPos);
			iCurSection--;
			iTickSection = 10;
		}
	}

	//kill off each section
	if(IsHead && !IsVisible)
	{
		iTickToDeath--;
		if(iTickToDeath<=0)
		{
			if(iCurSegDeath>=0 && mSections[iCurSegDeath].IsActive)
			{
				mSections[iCurSegDeath].IsVisible = false;
				gpEngine->SpawnExplosion(gpEngine->sprExplosionSmall,mSections[iCurSegDeath].Pos+Vec2(60,10),120,0.75f,(float)(rand()%360),false);
				if(iCurSegDeath>0)
					SND_MEDEXPLODE;
				else
					SND_LARGEEXPLODE2;
				iCurSegDeath--;
			}
			else
				IsActive = false;
			iTickToDeath=5;
		}
	}

	//fire from tail
	if(IsHead && IsVisible)
	if(RateofFire>0)
	{
		if(mSections.front().IsVisible && mSections.front().IsActive)
		if(gpEngine->mTimer.GetTime()>=fLastFireTime+(0.25f*gpEngine->fGameDifficulty))
		{
			fLastFireTime = gpEngine->mTimer.GetTime();
			Bullet b;
			b.pSpawn = Spawn_BasicBullet;
			b.pUpdate = Update_BasicBullet;
			b.pRender = Render_BasicBullet;
			b.pCollide = Collide_BasicBullet;
			Vec2 v = FireAtTarget(mSections.front().Pos+Vec2(48,-16),gpEngine->mPlayer.mSphere.p,3.5f);
			(*b.pSpawn)(b,mSections.front().Pos+Vec2(48,-16),v);
			gpEngine->SpawnBullet(b,false);
			SND_LASER5;
		}
	}
}