Add Throw Explosive Animation Notifier
This commit is contained in:
parent
eaa81f4478
commit
aef9f87dbf
|
@ -0,0 +1,15 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "../AnimNotify/NakatomiThrowExplosiveNotify.h"
|
||||||
|
#include "Nakatomi/PlayerCharacter.h"
|
||||||
|
|
||||||
|
void UNakatomiThrowExplosiveNotify::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation)
|
||||||
|
{
|
||||||
|
APlayerCharacter* Character = Cast<APlayerCharacter>(MeshComp->GetOwner());
|
||||||
|
|
||||||
|
if (Character != nullptr)
|
||||||
|
{
|
||||||
|
Character->ThrowExplosive();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Animation/AnimNotifies/AnimNotify.h"
|
||||||
|
#include "NakatomiThrowExplosiveNotify.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class NAKATOMI_API UNakatomiThrowExplosiveNotify : public UAnimNotify
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) override;
|
||||||
|
|
||||||
|
};
|
|
@ -731,8 +731,12 @@ void APlayerCharacter::ThrowExplosiveCallback()
|
||||||
{
|
{
|
||||||
if (ThrowableInventory.Num() > 0)
|
if (ThrowableInventory.Num() > 0)
|
||||||
{
|
{
|
||||||
PlayAnimMontage(ThrowAnimMontage);
|
PlayAnimMontage(ThrowExplosiveAnimMontage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void APlayerCharacter::ThrowExplosive()
|
||||||
|
{
|
||||||
FVector Location;
|
FVector Location;
|
||||||
FVector BoxExtent;
|
FVector BoxExtent;
|
||||||
GetActorBounds(true, Location, BoxExtent, false);
|
GetActorBounds(true, Location, BoxExtent, false);
|
||||||
|
@ -744,7 +748,6 @@ void APlayerCharacter::ThrowExplosiveCallback()
|
||||||
|
|
||||||
GetWorld()->SpawnActor<AThrowable>(ThrowableInventory.Pop(), SpawnLocation, FRotator::ZeroRotator);
|
GetWorld()->SpawnActor<AThrowable>(ThrowableInventory.Pop(), SpawnLocation, FRotator::ZeroRotator);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
AThrowable* APlayerCharacter::ThrowThrowable()
|
AThrowable* APlayerCharacter::ThrowThrowable()
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,9 @@ public:
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
UAnimMontage* ThrowWeaponAnimMontage;
|
UAnimMontage* ThrowWeaponAnimMontage;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
UAnimMontage* ThrowExplosiveAnimMontage;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
float SprintSpeedMultiplier = 2.0f;
|
float SprintSpeedMultiplier = 2.0f;
|
||||||
|
@ -221,6 +224,8 @@ public:
|
||||||
|
|
||||||
void ThrowExplosiveCallback();
|
void ThrowExplosiveCallback();
|
||||||
|
|
||||||
|
void ThrowExplosive();
|
||||||
|
|
||||||
AThrowable* ThrowThrowable();
|
AThrowable* ThrowThrowable();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
|
|
Loading…
Reference in New Issue