99 - Elim Animation
This commit is contained in:
parent
9999ef2d37
commit
659a9b30de
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -38,6 +38,7 @@ void UBlasterAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
|
||||||
bAiming = BlasterCharacter->IsAiming();
|
bAiming = BlasterCharacter->IsAiming();
|
||||||
TurningInPlace = BlasterCharacter->GetTurningInPlace();
|
TurningInPlace = BlasterCharacter->GetTurningInPlace();
|
||||||
bRotateRootBone = BlasterCharacter->ShouldRotateRootBone();
|
bRotateRootBone = BlasterCharacter->ShouldRotateRootBone();
|
||||||
|
bEliminated = BlasterCharacter->IsEliminated();
|
||||||
// Offset Yaw for Strafing
|
// Offset Yaw for Strafing
|
||||||
FRotator AimRotation = BlasterCharacter->GetBaseAimRotation();
|
FRotator AimRotation = BlasterCharacter->GetBaseAimRotation();
|
||||||
FRotator MovementRotation = UKismetMathLibrary::MakeRotFromX(BlasterCharacter->GetVelocity());
|
FRotator MovementRotation = UKismetMathLibrary::MakeRotFromX(BlasterCharacter->GetVelocity());
|
||||||
|
|
|
@ -75,4 +75,7 @@ private:
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, Category="Movement", meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(BlueprintReadOnly, Category="Movement", meta=(AllowPrivateAccess = "true"))
|
||||||
bool bRotateRootBone;
|
bool bRotateRootBone;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, Category="Movement", meta=(AllowPrivateAccess = "true"))
|
||||||
|
bool bEliminated;
|
||||||
};
|
};
|
||||||
|
|
|
@ -100,9 +100,20 @@ void ABlasterCharacter::PlayFireMontage(bool bAiming)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::Eliminated()
|
void ABlasterCharacter::PlayEliminatedMontage()
|
||||||
{
|
{
|
||||||
|
UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();
|
||||||
|
if (AnimInstance && EliminatedMontage)
|
||||||
|
{
|
||||||
|
UE_LOG(LogTemp, Warning, TEXT("Playing Eliminated Montage, %s"), (bEliminated ? "true" : "false"));
|
||||||
|
AnimInstance->Montage_Play(EliminatedMontage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ABlasterCharacter::Eliminated_Implementation()
|
||||||
|
{
|
||||||
|
bEliminated = true;
|
||||||
|
PlayEliminatedMontage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::PlayHitReactMontage()
|
void ABlasterCharacter::PlayHitReactMontage()
|
||||||
|
@ -124,7 +135,10 @@ void ABlasterCharacter::ReceiveDamage(AActor* DamagedActor, float Damage, const
|
||||||
Health = FMath::Clamp(Health - Damage, 0.f, MaxHealth);
|
Health = FMath::Clamp(Health - Damage, 0.f, MaxHealth);
|
||||||
|
|
||||||
UpdateHUDHealth();
|
UpdateHUDHealth();
|
||||||
PlayHitReactMontage();
|
if (Health > 0.f)
|
||||||
|
{
|
||||||
|
PlayHitReactMontage();
|
||||||
|
}
|
||||||
|
|
||||||
if (Health == 0.f)
|
if (Health == 0.f)
|
||||||
{
|
{
|
||||||
|
@ -388,18 +402,18 @@ void ABlasterCharacter::TurnInPlace(float DeltaTime)
|
||||||
StartingAimRotation = FRotator(0.f, GetBaseAimRotation().Yaw, 0.f);
|
StartingAimRotation = FRotator(0.f, GetBaseAimRotation().Yaw, 0.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (TurningInPlace)
|
// switch (TurningInPlace)
|
||||||
{
|
// {
|
||||||
case ETurningInPlace::ETIP_Left:
|
// case ETurningInPlace::ETIP_Left:
|
||||||
UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: Left"));
|
// UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: Left"));
|
||||||
break;
|
// break;
|
||||||
case ETurningInPlace::ETIP_Right:
|
// case ETurningInPlace::ETIP_Right:
|
||||||
UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: Right"));
|
// UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: Right"));
|
||||||
break;
|
// break;
|
||||||
case ETurningInPlace::ETIP_NotTurning:
|
// case ETurningInPlace::ETIP_NotTurning:
|
||||||
UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: NotTurning"));
|
// UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: NotTurning"));
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::HideCameraIfCharacterClose()
|
void ABlasterCharacter::HideCameraIfCharacterClose()
|
||||||
|
@ -433,7 +447,10 @@ float ABlasterCharacter::CalculateSpeed()
|
||||||
void ABlasterCharacter::OnRep_Health()
|
void ABlasterCharacter::OnRep_Health()
|
||||||
{
|
{
|
||||||
UpdateHUDHealth();
|
UpdateHUDHealth();
|
||||||
PlayHitReactMontage();
|
if (Health > 0.f)
|
||||||
|
{
|
||||||
|
PlayHitReactMontage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::UpdateHUDHealth()
|
void ABlasterCharacter::UpdateHUDHealth()
|
||||||
|
|
|
@ -21,6 +21,9 @@ public:
|
||||||
virtual void PostInitializeComponents() override;
|
virtual void PostInitializeComponents() override;
|
||||||
virtual void OnRep_ReplicatedMovement() override;
|
virtual void OnRep_ReplicatedMovement() override;
|
||||||
void PlayFireMontage(bool bAiming);
|
void PlayFireMontage(bool bAiming);
|
||||||
|
void PlayEliminatedMontage();
|
||||||
|
|
||||||
|
UFUNCTION(NetMulticast, Reliable)
|
||||||
void Eliminated();
|
void Eliminated();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -81,6 +84,9 @@ private:
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, Category = Combat)
|
UPROPERTY(EditAnywhere, Category = Combat)
|
||||||
class UAnimMontage* HitReactMontage;
|
class UAnimMontage* HitReactMontage;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category = Combat)
|
||||||
|
class UAnimMontage* EliminatedMontage;
|
||||||
|
|
||||||
void HideCameraIfCharacterClose();
|
void HideCameraIfCharacterClose();
|
||||||
|
|
||||||
|
@ -107,6 +113,8 @@ private:
|
||||||
void OnRep_Health();
|
void OnRep_Health();
|
||||||
|
|
||||||
class ABlasterPlayerController* BlasterPlayerController;
|
class ABlasterPlayerController* BlasterPlayerController;
|
||||||
|
|
||||||
|
bool bEliminated = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetOverlappingWeapon(AWeapon* Weapon);
|
void SetOverlappingWeapon(AWeapon* Weapon);
|
||||||
|
@ -119,4 +127,5 @@ public:
|
||||||
FVector GetHitTarget() const;
|
FVector GetHitTarget() const;
|
||||||
FORCEINLINE UCameraComponent* GetFollowCamera() const { return FollowCamera; }
|
FORCEINLINE UCameraComponent* GetFollowCamera() const { return FollowCamera; }
|
||||||
FORCEINLINE bool ShouldRotateRootBone() const { return bRotateRootBone; }
|
FORCEINLINE bool ShouldRotateRootBone() const { return bRotateRootBone; }
|
||||||
|
FORCEINLINE bool IsEliminated() const { return bEliminated; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,8 +3,14 @@
|
||||||
|
|
||||||
#include "BlasterGameMode.h"
|
#include "BlasterGameMode.h"
|
||||||
|
|
||||||
void ABlasterGameMode::PlayerEliminated(ABlasterCharacter* ElimmedCharacter, ABlasterPlayerController* VictimController,
|
#include "Blaster/Character/BlasterCharacter.h"
|
||||||
ABlasterPlayerController* AttackerController)
|
|
||||||
|
void ABlasterGameMode::PlayerEliminated(ABlasterCharacter* EliminatedCharacter, ABlasterPlayerController* VictimController,
|
||||||
|
ABlasterPlayerController* AttackerController)
|
||||||
{
|
{
|
||||||
|
if (EliminatedCharacter)
|
||||||
|
{
|
||||||
|
EliminatedCharacter->Eliminated();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,5 @@ class BLASTER_API ABlasterGameMode : public AGameMode
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void PlayerEliminated(class ABlasterCharacter* ElimmedCharacter, class ABlasterPlayerController* VictimController, class ABlasterPlayerController* AttackerController);
|
virtual void PlayerEliminated(class ABlasterCharacter* EliminatedCharacter, class ABlasterPlayerController* VictimController, class ABlasterPlayerController* AttackerController);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue