Compare commits

..

No commits in common. "fcb32e5679d8838d557340c8bc85fbcd8a04628c" and "d96a5c837a949262f839f36b331a6023a10b3616" have entirely different histories.

10 changed files with 35 additions and 123 deletions

Binary file not shown.

BIN
Content/AnimStarterPack/Throw_Montage.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
Content/Player/PlayerCharacter.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -1,15 +0,0 @@
// 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();
}
}

View File

@ -1,21 +0,0 @@
// 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;
};

View File

@ -1,16 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "../AnimNotify/NakatomiThrowWeaponNotify.h"
#include "Nakatomi/PlayerCharacter.h"
void UNakatomiThrowWeaponNotify::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation)
{
APlayerCharacter* Character = Cast<APlayerCharacter>(MeshComp->GetOwner());
if (Character != nullptr)
{
Character->ThrowWeapon();
}
}

View File

@ -1,20 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimNotifies/AnimNotify.h"
#include "NakatomiThrowWeaponNotify.generated.h"
/**
*
*/
UCLASS()
class NAKATOMI_API UNakatomiThrowWeaponNotify : public UAnimNotify
{
GENERATED_BODY()
public:
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation) override;
};

View File

@ -703,50 +703,44 @@ void APlayerCharacter::ThrowWeaponCallback()
{
if (CurrentWeapon)
{
PlayAnimMontage(ThrowWeaponAnimMontage);
PlayAnimMontage(ThrowAnimMontage);
FVector Location;
FVector BoxExtent;
GetActorBounds(true, Location, BoxExtent, false);
FVector SpawnLocation = (BoxExtent.X * GetActorForwardVector()) * 2;
SpawnLocation += Location;
SpawnLocation.Z += BoxExtent.Z;
TSubclassOf<AWeaponThrowable> WeaponThrowableTemplate = CurrentWeapon->GetWeaponThrowableTemplate();
AWeaponThrowable* Throwable = GetWorld()->SpawnActor<AWeaponThrowable>(
WeaponThrowableTemplate, SpawnLocation, FRotator::ZeroRotator);
Throwable->SetWeaponSkeletalMesh(GetCurrentWeapon()->GetSkeletalMesh());
RemoveCurrentWeaponFromInventory();
}
}
void APlayerCharacter::ThrowWeapon()
{
FVector Location;
FVector BoxExtent;
GetActorBounds(true, Location, BoxExtent, false);
FVector SpawnLocation = (BoxExtent.X * GetActorForwardVector()) * 2;
SpawnLocation += Location;
SpawnLocation.Z += BoxExtent.Z;
TSubclassOf<AWeaponThrowable> WeaponThrowableTemplate = CurrentWeapon->GetWeaponThrowableTemplate();
AWeaponThrowable* Throwable = GetWorld()->SpawnActor<AWeaponThrowable>(
WeaponThrowableTemplate, SpawnLocation, FRotator::ZeroRotator);
Throwable->SetWeaponSkeletalMesh(GetCurrentWeapon()->GetSkeletalMesh());
RemoveCurrentWeaponFromInventory();
}
void APlayerCharacter::ThrowExplosiveCallback()
{
if (ThrowableInventory.Num() > 0)
{
PlayAnimMontage(ThrowExplosiveAnimMontage);
}
}
void APlayerCharacter::ThrowExplosive()
{
FVector Location;
FVector BoxExtent;
GetActorBounds(true, Location, BoxExtent, false);
PlayAnimMontage(ThrowAnimMontage);
FVector Location;
FVector BoxExtent;
GetActorBounds(true, Location, BoxExtent, false);
FVector SpawnLocation = (BoxExtent.X * GetActorForwardVector()) * 2;
SpawnLocation += Location;
SpawnLocation += (25.0f * GetActorForwardVector());
SpawnLocation.Z += BoxExtent.Z;
FVector SpawnLocation = (BoxExtent.X * GetActorForwardVector()) * 2;
SpawnLocation += Location;
SpawnLocation += (25.0f * GetActorForwardVector());
SpawnLocation.Z += BoxExtent.Z;
GetWorld()->SpawnActor<AThrowable>(ThrowableInventory.Pop(), SpawnLocation, FRotator::ZeroRotator);
GetWorld()->SpawnActor<AThrowable>(ThrowableInventory.Pop(), SpawnLocation, FRotator::ZeroRotator);
}
}
AThrowable* APlayerCharacter::ThrowThrowable()

View File

@ -84,10 +84,7 @@ public:
FOnEnemyHitDelegate OnEnemyHit;
UPROPERTY(EditDefaultsOnly)
UAnimMontage* ThrowWeaponAnimMontage;
UPROPERTY(EditDefaultsOnly)
UAnimMontage* ThrowExplosiveAnimMontage;
UAnimMontage* ThrowAnimMontage;
protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
@ -220,11 +217,7 @@ public:
void ThrowWeaponCallback();
void ThrowWeapon();
void ThrowExplosiveCallback();
void ThrowExplosive();
AThrowable* ThrowThrowable();