140 - Sniper Scope
This commit is contained in:
parent
7a26940641
commit
977cdef60c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -137,6 +137,10 @@ void ABlasterCharacter::MulticastEliminated_Implementation()
|
||||||
GetActorLocation()
|
GetActorLocation()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (IsLocallyControlled() && GetEquippedWeapon()->GetWeaponType() == EWeaponType::EWT_SniperRifle && IsAiming())
|
||||||
|
{
|
||||||
|
ShowSniperScopeWidget(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::EliminationTimerFinished()
|
void ABlasterCharacter::EliminationTimerFinished()
|
||||||
|
|
|
@ -37,6 +37,9 @@ public:
|
||||||
UPROPERTY(Replicated)
|
UPROPERTY(Replicated)
|
||||||
bool bDisableGameplay = false;
|
bool bDisableGameplay = false;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
|
void ShowSniperScopeWidget(bool bShowScope);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
|
|
@ -420,11 +420,15 @@ void UCombatComponent::InterpFOV(float DeltaTime)
|
||||||
|
|
||||||
void UCombatComponent::SetAiming(bool bIsAiming)
|
void UCombatComponent::SetAiming(bool bIsAiming)
|
||||||
{
|
{
|
||||||
|
if (Character == nullptr || EquippedWeapon == nullptr) return;
|
||||||
bAiming = bIsAiming;
|
bAiming = bIsAiming;
|
||||||
ServerSetAiming(bIsAiming);
|
ServerSetAiming(bIsAiming);
|
||||||
if (Character)
|
|
||||||
{
|
|
||||||
Character->GetCharacterMovement()->MaxWalkSpeed = bIsAiming ? AimWalkSpeed : BaseWalkSpeed;
|
Character->GetCharacterMovement()->MaxWalkSpeed = bIsAiming ? AimWalkSpeed : BaseWalkSpeed;
|
||||||
|
|
||||||
|
if (Character->IsLocallyControlled() && EquippedWeapon->GetWeaponType() == EWeaponType::EWT_SniperRifle)
|
||||||
|
{
|
||||||
|
Character->ShowSniperScopeWidget(bIsAiming);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue