void ASBombActor::OnRep_FuzeActive() { if (bIsFuzeActive && !bExploded) { SimulateFuzeFX(); } }
void ASBombActor::OnUsed(APawn* InstigatorPawn) { Super::OnUsed(InstigatorPawn); if (!bIsFuzeActive) { // This will trigger the SimulateFuzeFX() on the clients bIsFuzeActive = true; // Repnotify does not trigger on the server, so call the function here directly. SimulateFuzeFX(); // Activate the fuze to explode the bomb after several seconds GetWorldTimerManager().SetTimer(FuzeTimerHandle, this, &ASBombActor::OnExplode, MaxFuzeTime, false); } }
void ASBombActor::OnUsed(APawn* InstigatorPawn) { if (bIsFuzeActive) { return; } Super::OnUsed(InstigatorPawn); bIsFuzeActive = true; // Runs on all clients (NetMulticast) SimulateFuzeFX(); // Activate the fuze to explode the bomb after several seconds GetWorldTimerManager().SetTimer(FuzeTimerHandle, this, &ASBombActor::OnExplode, MaxFuzeTime, false); }