178 - Client-Side Predicting Aiming
This commit is contained in:
parent
41a200110b
commit
58a06d4366
|
@ -760,6 +760,7 @@ void UCombatComponent::SetAiming(bool bIsAiming)
|
|||
{
|
||||
Character->ShowSniperScopeWidget(bIsAiming);
|
||||
}
|
||||
if (Character->IsLocallyControlled()) bAimButtonPressed = bIsAiming;
|
||||
}
|
||||
|
||||
void UCombatComponent::ServerSetAiming_Implementation(bool bIsAiming)
|
||||
|
@ -771,6 +772,14 @@ void UCombatComponent::ServerSetAiming_Implementation(bool bIsAiming)
|
|||
}
|
||||
}
|
||||
|
||||
void UCombatComponent::OnRep_Aiming()
|
||||
{
|
||||
if (Character && Character->IsLocallyControlled())
|
||||
{
|
||||
bAiming = bAimButtonPressed;
|
||||
}
|
||||
}
|
||||
|
||||
bool UCombatComponent::CanFire()
|
||||
{
|
||||
if (PrimaryWeapon == nullptr) return false;
|
||||
|
|
|
@ -120,8 +120,13 @@ private:
|
|||
UPROPERTY(ReplicatedUsing=OnRep_SecondaryWeapon)
|
||||
AWeapon* SecondaryWeapon;
|
||||
|
||||
UPROPERTY(Replicated)
|
||||
bool bAiming;
|
||||
UPROPERTY(ReplicatedUsing = OnRep_Aiming)
|
||||
bool bAiming = false;
|
||||
|
||||
bool bAimButtonPressed = false;
|
||||
|
||||
UFUNCTION()
|
||||
void OnRep_Aiming();
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
float BaseWalkSpeed;
|
||||
|
|
Loading…
Reference in New Issue