void AFPSGCharacter::Destroyed()
{
	Super::Destroyed();

	//GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, "AFPSGCharacter::Destroyed()");

	destroyInventory();
}
Parallaction_br::~Parallaction_br() {
	freeFonts();
	freeCharacter();

	destroyInventory();

	delete _objects;

	delete _locationParser;
	delete _programParser;

	_location._animations.remove(_char._ani);

	delete _walker;
}
void AFPSGCharacter::die(AFPSGPlayerController* killer)
{
	if (GEngine != NULL)
	{
		//GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Yellow, TEXT("AFPSGCharacter::die"));
	}

	//Destroy the player inventory
	destroyInventory();

	AFPSGPlayerController* myPlayerController = Cast<AFPSGPlayerController>(GetController());

	if (myPlayerController != NULL)
	{
		//Set to true, and when replicated to clients, will call the callback function onRep_DieOwnerOnly in player controller
		myPlayerController->setDieCallback(true);

		//We are the server, but just to be sure
		if (Role == ROLE_Authority)
		{
			//Server have to manually call the onRep_DieOwnerOnly callback
			myPlayerController->onRep_DieOwnerOnly();

			AFPSGGameMode* gameMode = GetWorld() ? GetWorld()->GetAuthGameMode<AFPSGGameMode>() : NULL;

			if (gameMode != NULL)
			{
				gameMode->notifyKill(killer, myPlayerController);
			}
		}
	}

	//Set to true, and when replicated to clients, will call the callback function onRep_DieAll
	dieCallback = true;

	//We are the server, but just to be sure
	if (Role == ROLE_Authority)
	{
		//Server have to manually call the onRep_DieAll callback
		onRep_DieAll();
	}

	//Calls our controller PawnPendingDestroy function
	DetachFromControllerPendingDestroy();
}
Parallaction_ns::~Parallaction_ns() {
	freeFonts();

	// TODO: we may want to add a ~Character instead
	freeCharacter();
	_char._ani.reset();

	destroyInventory();

	delete _locationParser;
	delete _programParser;
	freeLocation(true);

	_location._animations.remove(_char._ani);

	delete _walker;

	destroyTestResultLabels();
}