Ejemplo n.º 1
0
void APawn::PossessedBy(AController* NewController)
{
	AController* const OldController = Controller;

	Controller = NewController;
	ForceNetUpdate();

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

	if (APlayerController* PlayerController = Cast<APlayerController>(Controller))
	{
		if (GetNetMode() != NM_Standalone)
		{
			SetReplicates(true);
			SetAutonomousProxy(true);
		}
	}
	else
	{
		CopyRemoteRoleFrom(GetDefault<APawn>());
	}

	// dispatch Blueprint event if necessary
	if (OldController != NewController)
	{
		ReceivePossessed(Controller);
	}
}
void AOnlineBeaconClient::ClientOnConnected_Implementation()
{
	SetConnectionState(EBeaconConnectionState::Open);
	BeaconConnection->State = USOCK_Open;

	Role = ROLE_Authority;
	SetReplicates(true);
	SetAutonomousProxy(true);

	// Fail safe for connection to server but no client connection RPC
	GetWorldTimerManager().ClearTimer(TimerHandle_OnFailure);

	// Call the overloaded function for this client class
	OnConnected();
}
Ejemplo n.º 3
0
void AOnlineBeaconClient::ClientOnConnected_Implementation()
{
	Role = ROLE_Authority;
	SetReplicates(true);
	SetAutonomousProxy(true);

	// Fail safe for connection to server but no client connection RPC
	GetWorldTimerManager().ClearTimer(TimerHandle_OnFailure);

	if (NetDriver)
	{
		// Increase timeout while we are connected
		NetDriver->InitialConnectTimeout = BeaconConnectionTimeout;
		NetDriver->ConnectionTimeout = BeaconConnectionTimeout;
	}

	// Call the overloaded function for this client class
	OnConnected();
}