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);
|
Character->ShowSniperScopeWidget(bIsAiming);
|
||||||
}
|
}
|
||||||
|
if (Character->IsLocallyControlled()) bAimButtonPressed = bIsAiming;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UCombatComponent::ServerSetAiming_Implementation(bool 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()
|
bool UCombatComponent::CanFire()
|
||||||
{
|
{
|
||||||
if (PrimaryWeapon == nullptr) return false;
|
if (PrimaryWeapon == nullptr) return false;
|
||||||
|
|
|
@ -120,8 +120,13 @@ private:
|
||||||
UPROPERTY(ReplicatedUsing=OnRep_SecondaryWeapon)
|
UPROPERTY(ReplicatedUsing=OnRep_SecondaryWeapon)
|
||||||
AWeapon* SecondaryWeapon;
|
AWeapon* SecondaryWeapon;
|
||||||
|
|
||||||
UPROPERTY(Replicated)
|
UPROPERTY(ReplicatedUsing = OnRep_Aiming)
|
||||||
bool bAiming;
|
bool bAiming = false;
|
||||||
|
|
||||||
|
bool bAimButtonPressed = false;
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OnRep_Aiming();
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
float BaseWalkSpeed;
|
float BaseWalkSpeed;
|
||||||
|
|
Loading…
Reference in New Issue