146 - Grenade Throw Montage
This commit is contained in:
parent
b225f72e46
commit
ecf950ba75
|
@ -19,6 +19,7 @@ r.GenerateMeshDistanceFields=True
|
|||
r.DynamicGlobalIlluminationMethod=1
|
||||
r.ReflectionMethod=1
|
||||
r.Shadow.Virtual.Enable=1
|
||||
r.CustomDepth=3
|
||||
|
||||
[/Script/WorldPartitionEditor.WorldPartitionEditorSettings]
|
||||
bEnableWorldPartition=False
|
||||
|
@ -139,3 +140,7 @@ bMirrorAchievementsToEOS=False
|
|||
bUseEOSSessions=False
|
||||
bMirrorPresenceToEAS=False
|
||||
|
||||
[/Script/Engine.PhysicsSettings]
|
||||
bSubstepping=True
|
||||
MaxSubstepDeltaTime=0.008000
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ bUseMouseForTouch=False
|
|||
bEnableMouseSmoothing=True
|
||||
bEnableFOVScaling=True
|
||||
bCaptureMouseOnLaunch=True
|
||||
bEnableLegacyInputScales=True
|
||||
bAlwaysShowTouchInterface=False
|
||||
bShowConsoleOnFourFingerTap=True
|
||||
bEnableGestureRecognizer=False
|
||||
|
@ -83,6 +84,7 @@ DoubleClickTime=0.200000
|
|||
+ActionMappings=(ActionName="Aim",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=RightMouseButton)
|
||||
+ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
|
||||
+ActionMappings=(ActionName="Reload",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R)
|
||||
+ActionMappings=(ActionName="ThrowGrenade",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=G)
|
||||
+AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W)
|
||||
+AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S)
|
||||
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -73,7 +73,7 @@ void UBlasterAnimInstance::NativeUpdateAnimation(float DeltaTime)
|
|||
}
|
||||
}
|
||||
|
||||
bUseFABRIK = BlasterCharacter->GetCombatState() != ECombatState::ECS_Reloading;
|
||||
bUseAimOffsets = BlasterCharacter->GetCombatState() != ECombatState::ECS_Reloading && !BlasterCharacter->GetDisableGameplay();
|
||||
bTransformRightHand = BlasterCharacter->GetCombatState() != ECombatState::ECS_Reloading && !BlasterCharacter->GetDisableGameplay();
|
||||
bUseFABRIK = BlasterCharacter->GetCombatState() == ECombatState::ECS_Unoccupied;
|
||||
bUseAimOffsets = BlasterCharacter->GetCombatState() == ECombatState::ECS_Unoccupied && !BlasterCharacter->GetDisableGameplay();
|
||||
bTransformRightHand = BlasterCharacter->GetCombatState() == ECombatState::ECS_Unoccupied && !BlasterCharacter->GetDisableGameplay();
|
||||
}
|
||||
|
|
|
@ -231,6 +231,7 @@ void ABlasterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCo
|
|||
PlayerInputComponent->BindAction("Fire", IE_Pressed, this, &ABlasterCharacter::FireButtonPressed);
|
||||
PlayerInputComponent->BindAction("Fire", IE_Released, this, &ABlasterCharacter::FireButtonReleased);
|
||||
PlayerInputComponent->BindAction("Reload", IE_Pressed, this, &ABlasterCharacter::ReloadButtonPressed);
|
||||
PlayerInputComponent->BindAction("ThrowGrenade", IE_Pressed, this, &ABlasterCharacter::GrenadeButtonPressed);
|
||||
}
|
||||
|
||||
void ABlasterCharacter::PostInitializeComponents()
|
||||
|
@ -307,6 +308,15 @@ void ABlasterCharacter::PlayEliminatedMontage()
|
|||
}
|
||||
}
|
||||
|
||||
void ABlasterCharacter::PlayThrowGrenadeMontage()
|
||||
{
|
||||
UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();
|
||||
if (AnimInstance && ThrowGrenadeMontage)
|
||||
{
|
||||
AnimInstance->Montage_Play(ThrowGrenadeMontage);
|
||||
}
|
||||
}
|
||||
|
||||
void ABlasterCharacter::PlayHitReactMontage()
|
||||
{
|
||||
if (Combat == nullptr || Combat->EquippedWeapon == nullptr) return;
|
||||
|
@ -434,6 +444,14 @@ void ABlasterCharacter::AimButtonReleased()
|
|||
}
|
||||
}
|
||||
|
||||
void ABlasterCharacter::GrenadeButtonPressed()
|
||||
{
|
||||
if (Combat)
|
||||
{
|
||||
Combat->ThrowGrenade();
|
||||
}
|
||||
}
|
||||
|
||||
float ABlasterCharacter::CalculateSpeed()
|
||||
{
|
||||
FVector Velocity = GetVelocity();
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
void PlayFireMontage(bool bAiming);
|
||||
void PlayReloadMontage();
|
||||
void PlayEliminatedMontage();
|
||||
void PlayThrowGrenadeMontage();
|
||||
|
||||
void Eliminated();
|
||||
|
||||
|
@ -52,6 +53,7 @@ protected:
|
|||
void CrouchButtonPressed();
|
||||
void AimButtonPressed();
|
||||
void AimButtonReleased();
|
||||
void GrenadeButtonPressed();
|
||||
void CalculateAO_Pitch();
|
||||
void AimOffset(float DeltaTime);
|
||||
void SimProxiesTurn();
|
||||
|
@ -115,6 +117,9 @@ private:
|
|||
UPROPERTY(EditAnywhere, Category = Combat)
|
||||
class UAnimMontage* EliminatedMontage;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = Combat)
|
||||
class UAnimMontage* ThrowGrenadeMontage;
|
||||
|
||||
void HideCameraIfCharacterClose();
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
|
|
|
@ -146,6 +146,7 @@ void UCombatComponent::MulticastFire_Implementation(const FVector_NetQuantize& T
|
|||
void UCombatComponent::EquipWeapon(AWeapon* WeaponToEquip)
|
||||
{
|
||||
if (Character == nullptr || WeaponToEquip == nullptr) return;
|
||||
if (CombatState != ECombatState::ECS_Unoccupied) return;
|
||||
if (EquippedWeapon)
|
||||
{
|
||||
EquippedWeapon->Dropped();
|
||||
|
@ -191,7 +192,7 @@ void UCombatComponent::EquipWeapon(AWeapon* WeaponToEquip)
|
|||
|
||||
void UCombatComponent::Reload()
|
||||
{
|
||||
if (CarriedAmmo > 0 && CombatState != ECombatState::ECS_Reloading)
|
||||
if (CarriedAmmo > 0 && CombatState == ECombatState::ECS_Unoccupied)
|
||||
{
|
||||
ServerReload();
|
||||
}
|
||||
|
@ -271,6 +272,11 @@ void UCombatComponent::JumpToShotgunEnd()
|
|||
}
|
||||
}
|
||||
|
||||
void UCombatComponent::ThrowGrenadeFinished()
|
||||
{
|
||||
CombatState = ECombatState::ECS_Unoccupied;
|
||||
}
|
||||
|
||||
void UCombatComponent::OnRep_CombatState()
|
||||
{
|
||||
switch (CombatState)
|
||||
|
@ -284,6 +290,12 @@ void UCombatComponent::OnRep_CombatState()
|
|||
Fire();
|
||||
}
|
||||
break;
|
||||
case ECombatState::ECS_ThrowingGrenade:
|
||||
if (Character && !Character->IsLocallyControlled())
|
||||
{
|
||||
Character->PlayThrowGrenadeMontage();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,6 +318,33 @@ int32 UCombatComponent::AmountToReload()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void UCombatComponent::ThrowGrenade()
|
||||
{
|
||||
if (CombatState != ECombatState::ECS_Unoccupied) return;
|
||||
|
||||
CombatState = ECombatState::ECS_ThrowingGrenade;
|
||||
|
||||
if (Character)
|
||||
{
|
||||
Character->PlayThrowGrenadeMontage();
|
||||
}
|
||||
|
||||
if (Character && !Character->HasAuthority())
|
||||
{
|
||||
ServerThrowGrenade();
|
||||
}
|
||||
}
|
||||
|
||||
void UCombatComponent::ServerThrowGrenade_Implementation()
|
||||
{
|
||||
CombatState = ECombatState::ECS_ThrowingGrenade;
|
||||
|
||||
if (Character)
|
||||
{
|
||||
Character->PlayThrowGrenadeMontage();
|
||||
}
|
||||
}
|
||||
|
||||
void UCombatComponent::OnRep_EquippedWeapon()
|
||||
{
|
||||
if (EquippedWeapon && Character)
|
||||
|
|
|
@ -33,6 +33,9 @@ public:
|
|||
|
||||
void JumpToShotgunEnd();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ThrowGrenadeFinished();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
void SetAiming(bool bIsAiming);
|
||||
|
@ -59,6 +62,11 @@ protected:
|
|||
|
||||
void HandleReload();
|
||||
int32 AmountToReload();
|
||||
|
||||
void ThrowGrenade();
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void ServerThrowGrenade();
|
||||
private:
|
||||
UPROPERTY()
|
||||
class ABlasterCharacter* Character;
|
||||
|
|
|
@ -5,6 +5,7 @@ enum class ECombatState : uint8
|
|||
{
|
||||
ECS_Unoccupied UMETA(DisplayName = "Unoccupied"),
|
||||
ECS_Reloading UMETA(DisplayName = "Reloading"),
|
||||
ECS_ThrowingGrenade UMETA(DisplayName = "Throwing Grenade"),
|
||||
|
||||
ECS_MAX UMETA(DisplayName = "DefaultMAX")
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue