play death animation
This commit is contained in:
BIN
Content/Characters/Crunch/Animation/AM_Death_Cruch.uasset
LFS
Normal file
BIN
Content/Characters/Crunch/Animation/AM_Death_Cruch.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,10 @@
|
|||||||
|
|
||||||
#include "Crunch/Public/Character/CCharacter.h"
|
#include "Crunch/Public/Character/CCharacter.h"
|
||||||
|
|
||||||
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "Components/WidgetComponent.h"
|
#include "Components/WidgetComponent.h"
|
||||||
|
|
||||||
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "GAS/CAbilitySystemComponent.h"
|
#include "GAS/CAbilitySystemComponent.h"
|
||||||
#include "GAS/CAttributeSet.h"
|
#include "GAS/CAttributeSet.h"
|
||||||
#include "GAS/UCAbilitySystemStatics.h"
|
#include "GAS/UCAbilitySystemStatics.h"
|
||||||
@@ -125,12 +128,46 @@ void ACCharacter::UpdateHeadStatGaugeVisibility()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ACCharacter::SetStatusGaugeEnabled(bool bIsEnabled)
|
||||||
|
{
|
||||||
|
GetWorldTimerManager().ClearTimer(HeadStatGaugeVisibilityUpdateTimerHandle);
|
||||||
|
if (bIsEnabled)
|
||||||
|
{
|
||||||
|
ConfigureOverHeadStatusWidget();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OverHeadWidgetComponent->SetHiddenInGame(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACCharacter::PlayDeathAnimation()
|
||||||
|
{
|
||||||
|
if (DeathMontage)
|
||||||
|
{
|
||||||
|
PlayAnimMontage(DeathMontage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ACCharacter::StartDeathSequence()
|
void ACCharacter::StartDeathSequence()
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Warning, TEXT("----------------------------DEAD"));
|
OnDead();
|
||||||
|
PlayDeathAnimation();
|
||||||
|
SetStatusGaugeEnabled(false);
|
||||||
|
|
||||||
|
GetCharacterMovement()->SetMovementMode(MOVE_None);
|
||||||
|
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACCharacter::ReSpawn()
|
void ACCharacter::ReSpawn()
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Warning, TEXT("----------------------------Respawn"));
|
OnRespawn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACCharacter::OnDead()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACCharacter::OnRespawn()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,22 @@ void ACPlayerCharacter::HandleAbilityInput(const FInputActionValue& InputActionV
|
|||||||
: AbilitySystemComponent->AbilityLocalInputReleased(static_cast<int32>(InputID));
|
: AbilitySystemComponent->AbilityLocalInputReleased(static_cast<int32>(InputID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ACPlayerCharacter::OnDead()
|
||||||
|
{
|
||||||
|
if (const auto PlayerController { GetController<APlayerController>() })
|
||||||
|
{
|
||||||
|
DisableInput(PlayerController);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACPlayerCharacter::OnRespawn()
|
||||||
|
{
|
||||||
|
if (const auto PlayerController { GetController<APlayerController>() })
|
||||||
|
{
|
||||||
|
EnableInput(PlayerController);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FVector ACPlayerCharacter::GetLookRightDir() const
|
FVector ACPlayerCharacter::GetLookRightDir() const
|
||||||
{
|
{
|
||||||
return ViewCamera->GetRightVector();
|
return ViewCamera->GetRightVector();
|
||||||
|
|||||||
@@ -57,10 +57,18 @@ private:
|
|||||||
|
|
||||||
FTimerHandle HeadStatGaugeVisibilityUpdateTimerHandle;
|
FTimerHandle HeadStatGaugeVisibilityUpdateTimerHandle;
|
||||||
void UpdateHeadStatGaugeVisibility();
|
void UpdateHeadStatGaugeVisibility();
|
||||||
|
void SetStatusGaugeEnabled(bool bIsEnabled);
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
/* Death & Respawning */
|
/* Death & Respawning */
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
UPROPERTY(EditDefaultsOnly, Category="Death")
|
||||||
|
TObjectPtr<UAnimMontage> DeathMontage;
|
||||||
|
|
||||||
|
void PlayDeathAnimation();
|
||||||
|
|
||||||
void StartDeathSequence();
|
void StartDeathSequence();
|
||||||
void ReSpawn();
|
void ReSpawn();
|
||||||
|
virtual void OnDead();
|
||||||
|
virtual void OnRespawn();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,5 +55,9 @@ private:
|
|||||||
void HandleLookInput(const FInputActionValue& InputActionValue);
|
void HandleLookInput(const FInputActionValue& InputActionValue);
|
||||||
void HandleMoveInput(const FInputActionValue& InputActionValue);
|
void HandleMoveInput(const FInputActionValue& InputActionValue);
|
||||||
void HandleAbilityInput(const FInputActionValue& InputActionValue, ECAbilityInputID AbilityInputID);
|
void HandleAbilityInput(const FInputActionValue& InputActionValue, ECAbilityInputID AbilityInputID);
|
||||||
|
/*************************************************************************************/
|
||||||
|
//------------------------- Death && Respawn-------------------------------------------
|
||||||
|
/*************************************************************************************/
|
||||||
|
virtual void OnDead() override;
|
||||||
|
virtual void OnRespawn() override;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user