Exemple #1
0
void Hud::AddKillEvent(Person* attacker, JQuad* weapon, Person* victim) {
	if (mKillEvents.size() == 0) {
		mKillEventTimer = 0.0f;
	}
	KillEvent killevent = KillEvent();
	strcpy(killevent.attackername,attacker->mName);
	if (*mGameType == FFA) {
		if (attacker == mPlayer) {
			killevent.attackerteam = CT;
		}
		else {
			killevent.attackerteam = T;
		}
		if (victim == mPlayer) {
			killevent.victimteam = CT;
		}
		else {
			killevent.victimteam = T;
		}
	}
	else {
		killevent.attackerteam = attacker->mTeam;
		killevent.victimteam = victim->mTeam;
	}
	strcpy(killevent.victimname,victim->mName);
	killevent.weapon = weapon;
	mKillEvents.push_back(killevent);

	if (attacker == mPlayer) {
		mEventPerson = victim;
		mEventType = 0;
		mEventTime = 2000;
		strcpy(mEventText,"You killed ");
		if (attacker == victim) {
			mEventType = 2;
			strcpy(mEventText," killed yourself");
		}
	}
	else if (victim == mPlayer) {
		mEventPerson = attacker;
		mEventType = 1;
		mEventTime = 2000;
		strcpy(mEventText," killed you");
	}
	if (mKillEvents.size() > 5) {
		mKillEvents.erase(mKillEvents.begin());
	}
}
	void AIEventSender::WhenBeenKilled( long attackerType, const CGUID &attackerId )
	{
		m_AI->SendEvent( KillEvent( attackerId, attackerType ) );
	}