Esempio n. 1
0
void AController::Possess(APawn* InPawn)
{
	REDIRECT_ACTOR_TO_VLOG(InPawn, this);

	if (InPawn != NULL)
	{
		if (GetPawn() && GetPawn() != InPawn)
		{
			UnPossess();
		}

		if (InPawn->Controller != NULL)
		{
			InPawn->Controller->UnPossess();
		}

		InPawn->PossessedBy(this);
		SetPawn(InPawn);

		// update rotation to match possessed pawn's rotation
		SetControlRotation( Pawn->GetActorRotation() );

		Pawn->Restart();
	}
}
Esempio n. 2
0
void AController::Possess(APawn* InPawn)
{
	if (!HasAuthority())
	{
		FMessageLog("PIE").Warning(FText::Format(
			LOCTEXT("ControllerPossessAuthorityOnly", "Possess function should only be used by the network authority for {0}"),
			FText::FromName(GetFName())
			));
		return;
	}

	REDIRECT_OBJECT_TO_VLOG(InPawn, this);

	if (InPawn != NULL)
	{
		if (GetPawn() && GetPawn() != InPawn)
		{
			UnPossess();
		}

		if (InPawn->Controller != NULL)
		{
			InPawn->Controller->UnPossess();
		}

		InPawn->PossessedBy(this);
		SetPawn(InPawn);

		// update rotation to match possessed pawn's rotation
		SetControlRotation( Pawn->GetActorRotation() );

		Pawn->Restart();
	}
}
Esempio n. 3
0
void AController::UnPossess()
{
	if ( Pawn != NULL )
	{
		Pawn->UnPossessed();
		SetPawn(NULL);
	}
}
Esempio n. 4
0
void AShipAIController::Possess(APawn* PossessedPawn)
{
	SetPawn(PossessedPawn);
	if (PossessedPawn == nullptr)
	{
		return;
	}

	pawn = dynamic_cast<AFumagalliPawn *>(PossessedPawn);
}
Esempio n. 5
0
void AController::OnRep_Pawn()
{
	// Detect when pawn changes, so we can NULL out the controller on the old pawn
	if ( OldPawn != NULL && Pawn != OldPawn.Get() && OldPawn->Controller == this )
	{
		// Set the old controller to NULL, since we are no longer the owner, and can't rely on it replicating to us anymore
		OldPawn->Controller = NULL;
	}

	OldPawn = Pawn;

	SetPawn(Pawn);
}
Esempio n. 6
0
void AShipAIController::UnPossess()
{
	SetPawn(nullptr);
}