コード例 #1
0
ファイル: npc.cpp プロジェクト: matrixsmaster/tdws
bool CNPC::PlanTalking(void)
{
	int i,j,x,wants = 0;
	CNPC* npc = NULL;
	//gather all NPCs in current view
	for (i = 0; i < WRLD_CHR_VIEW; i++)
		for (j = 0; j < WRLD_CHR_VIEW; j++) {
			if (view[i][j].npc) {
				x = GetWantTalkTo(view[i][j].npc);
				if (x > wants) {
					npc = view[i][j].npc;
					wants = x;
				}
			}
		}
	if ((!npc) || (wants < 1)) return false;
	//if NPC is just right here, start talking
	if (distance(my_coord,npc->GetCrd()) < 1.5f)
		return StartTalking(npc);
	else {
		//set aim one cell near NPC
//		my_stats.aim = getnextpoint(npc->GetCrd(),my_coord,NULL);
//		my_stats.aimed = true;
		my_state = AimTo(getnextpoint(npc->GetCrd(),my_coord,NULL))? NPC_Running:NPC_Browsing;
	}
	return true;
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: Cores play a special animation when picked up and dropped
// Input  : pPhysGunUser - player picking up object
//			reason - type of pickup
//-----------------------------------------------------------------------------
void CPropGladosCore::OnPhysGunPickup( CBasePlayer* pPhysGunUser, PhysGunPickup_t reason )
{
	if ( m_bFirstPickup )
	{
		float flTalkingDelay = (CORETYPE_CURIOUS == m_iCoreType) ? (2.0f) : (0.0f);
		StartTalking ( flTalkingDelay );
	}

	m_bFirstPickup = false;
	ResetSequence(LookupSequence("turn"));

	// +use always enables motion on these props
	EnableMotion();

	BaseClass::OnPhysGunPickup ( pPhysGunUser, reason );
}
コード例 #3
0
//-----------------------------------------------------------------------------
// Purpose: Start playing personality VO list
// Input  : &inputdata - 
//-----------------------------------------------------------------------------
void CPropGladosCore::InputStartTalking ( inputdata_t &inputdata )
{
	StartTalking( 0.0f );
}