Compare commits
No commits in common. "b68fd35f4d5966b92290606e6b0242fdd04141ec" and "633c66ff6f952b74a6587e277374c44f1816c0f0" have entirely different histories.
b68fd35f4d
...
633c66ff6f
BIN
Content/Weapons/Pistol/Pistol.uasset
(Stored with Git LFS)
BIN
Content/Weapons/Pistol/Pistol.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Weapons/Shotgun/Shotgun.uasset
(Stored with Git LFS)
BIN
Content/Weapons/Shotgun/Shotgun.uasset
(Stored with Git LFS)
Binary file not shown.
@ -4,7 +4,6 @@
|
||||
#include "EnemyAIController.h"
|
||||
#include "EnemyHealthComponent.h"
|
||||
#include "InteractableComponent.h"
|
||||
#include "NiagaraFunctionLibrary.h"
|
||||
#include "BehaviorTree/BehaviorTree.h"
|
||||
#include "BehaviorTree/BlackboardComponent.h"
|
||||
#include "BehaviorTree/BlackboardData.h"
|
||||
@ -34,9 +33,8 @@ void AEnemyCharacter::OnFire()
|
||||
CurrentWeapon->SetCurrentWeaponStatus(Firing);
|
||||
|
||||
TArray<FHitResult> Hits = TArray<FHitResult>();
|
||||
FVector direction = FVector::ZeroVector;
|
||||
CalculateHits(&Hits, &direction);
|
||||
ProcessHits(Hits, direction);
|
||||
CalculateHits(&Hits);
|
||||
ProcessHits(Hits);
|
||||
|
||||
CurrentWeapon->PlayFireSoundAtLocation(GetActorLocation());
|
||||
|
||||
@ -70,7 +68,7 @@ void AEnemyCharacter::PlayOnFireAnimations()
|
||||
Super::PlayOnFireAnimations();
|
||||
}
|
||||
|
||||
void AEnemyCharacter::CalculateHits(TArray<FHitResult>* hits, FVector* dir)
|
||||
void AEnemyCharacter::CalculateHits(TArray<FHitResult>* hits)
|
||||
{
|
||||
// Set up randomness
|
||||
const int32 RandomSeed = FMath::Rand();
|
||||
@ -110,7 +108,7 @@ void AEnemyCharacter::CalculateHits(TArray<FHitResult>* hits, FVector* dir)
|
||||
}
|
||||
}
|
||||
|
||||
void AEnemyCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
|
||||
void AEnemyCharacter::ProcessHits(TArray<FHitResult> hits)
|
||||
{
|
||||
for (FHitResult Hit : hits)
|
||||
{
|
||||
@ -119,18 +117,10 @@ void AEnemyCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
|
||||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
|
||||
// Spawn field actor
|
||||
if (CurrentWeapon->GetFieldSystemActor())
|
||||
{
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform,
|
||||
SpawnParameters);
|
||||
|
||||
if (field)
|
||||
{
|
||||
field->Destroy();
|
||||
}
|
||||
}
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform,
|
||||
SpawnParameters);
|
||||
|
||||
if (Hit.GetActor())
|
||||
{
|
||||
@ -145,36 +135,6 @@ void AEnemyCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
|
||||
GetController(), this);
|
||||
}
|
||||
}
|
||||
|
||||
auto staticMeshComponent = Hit.GetActor()->GetComponentByClass<UStaticMeshComponent>();
|
||||
|
||||
if (staticMeshComponent && !staticMeshComponent->IsSimulatingPhysics() && CurrentWeapon->GetDecalActor())
|
||||
{
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
|
||||
auto decalActor = GetWorld()->SpawnActor<ADecalActor>(CurrentWeapon->GetDecalActor(), transform,
|
||||
SpawnParameters);
|
||||
auto rot = Hit.ImpactNormal.Rotation();
|
||||
rot.Roll += 90.0f;
|
||||
rot.Yaw += 180.0f;
|
||||
decalActor->SetActorRotation(rot);
|
||||
}
|
||||
|
||||
if (staticMeshComponent && !staticMeshComponent->IsSimulatingPhysics() &&
|
||||
CurrentWeapon->GetImpactParticleSystem())
|
||||
{
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
|
||||
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this,
|
||||
CurrentWeapon->GetImpactParticleSystem(),
|
||||
transform.GetLocation(),
|
||||
dir.MirrorByVector(Hit.ImpactNormal).Rotation(),
|
||||
FVector(1),
|
||||
true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,9 @@ protected:
|
||||
private:
|
||||
virtual void PlayOnFireAnimations() override;
|
||||
|
||||
virtual void CalculateHits(TArray<FHitResult>* hits, FVector* dir) override;
|
||||
virtual void CalculateHits(TArray<FHitResult>* hits) override;
|
||||
|
||||
virtual void ProcessHits(TArray<FHitResult> hits, FVector dir) override;
|
||||
virtual void ProcessHits(TArray<FHitResult> hits) override;
|
||||
|
||||
protected:
|
||||
virtual void OnDamaged() override;
|
||||
|
@ -11,7 +11,7 @@ public class Nakatomi : ModuleRules
|
||||
PublicDependencyModuleNames.AddRange(new[]
|
||||
{
|
||||
"Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "FieldSystemEngine",
|
||||
"GeometryCollectionEngine", "UMG", "AIModule", "GameplayTasks", "NavigationSystem", "Niagara"
|
||||
"GeometryCollectionEngine", "UMG", "AIModule", "GameplayTasks", "NavigationSystem"
|
||||
});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
@ -257,11 +257,11 @@ bool ANakatomiCharacter::GetCrouched()
|
||||
return false;
|
||||
}
|
||||
|
||||
void ANakatomiCharacter::CalculateHits(TArray<FHitResult>* hits, FVector* dir)
|
||||
void ANakatomiCharacter::CalculateHits(TArray<FHitResult>* hits)
|
||||
{
|
||||
}
|
||||
|
||||
void ANakatomiCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
|
||||
void ANakatomiCharacter::ProcessHits(TArray<FHitResult> hits)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,9 @@ public:
|
||||
bool GetCrouched();
|
||||
|
||||
protected:
|
||||
virtual void CalculateHits(TArray<FHitResult>* hits, FVector* dir);
|
||||
virtual void CalculateHits(TArray<FHitResult>* hits);
|
||||
|
||||
virtual void ProcessHits(TArray<FHitResult> hits, FVector dir);
|
||||
virtual void ProcessHits(TArray<FHitResult> hits);
|
||||
|
||||
virtual void PlayOnFireAnimations();
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "InteractableComponent.h"
|
||||
#include "NakatomiCMC.h"
|
||||
#include "WeaponThrowable.h"
|
||||
#include "NiagaraFunctionLibrary.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
|
||||
#define COLLISION_WEAPON ECC_GameTraceChannel1
|
||||
@ -319,7 +318,7 @@ void APlayerCharacter::SetWalkingCallback(const FInputActionInstance& Instance)
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits, FVector* dir)
|
||||
void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
|
||||
{
|
||||
// Set up the collision query params, use the Weapon trace settings, Ignore the actor firing this trace
|
||||
FCollisionQueryParams TraceParams(SCENE_QUERY_STAT(WeaponTrace), true, GetInstigator());
|
||||
@ -350,7 +349,6 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits, FVector* dir)
|
||||
TraceStart = GetRootComponent()->GetComponentLocation();
|
||||
FVector AimDir = CamHit.ImpactPoint - TraceStart;
|
||||
AimDir.Normalize();
|
||||
*dir = AimDir;
|
||||
TraceStart = TraceStart + AimDir * ((GetInstigator()->GetActorLocation() - TraceStart) | AimDir);
|
||||
|
||||
// Calculate the hit results from the trace
|
||||
@ -373,7 +371,7 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits, FVector* dir)
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
|
||||
void APlayerCharacter::ProcessHits(TArray<FHitResult> hits)
|
||||
{
|
||||
for (FHitResult Hit : hits)
|
||||
{
|
||||
@ -438,14 +436,12 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
|
||||
{
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
|
||||
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this,
|
||||
CurrentWeapon->GetImpactParticleSystem(),
|
||||
transform.GetLocation(),
|
||||
dir.MirrorByVector(Hit.ImpactNormal).Rotation(),
|
||||
FVector(1),
|
||||
true);
|
||||
|
||||
|
||||
UGameplayStatics::SpawnEmitterAtLocation(this,
|
||||
CurrentWeapon->GetImpactParticleSystem(),
|
||||
transform.GetLocation(),
|
||||
FRotator::ZeroRotator,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,9 +643,8 @@ void APlayerCharacter::OnFire()
|
||||
CurrentWeapon->SetCurrentWeaponStatus(Firing);
|
||||
|
||||
TArray<FHitResult> Hits = TArray<FHitResult>();
|
||||
FVector direction = FVector::ZeroVector;
|
||||
CalculateHits(&Hits, &direction);
|
||||
ProcessHits(Hits, direction);
|
||||
CalculateHits(&Hits);
|
||||
ProcessHits(Hits);
|
||||
|
||||
CurrentWeapon->DecrementAmmoCount(1);
|
||||
|
||||
|
@ -243,9 +243,9 @@ public:
|
||||
void SetIsThrowing(bool bIsThrowing);
|
||||
|
||||
protected:
|
||||
virtual void CalculateHits(TArray<FHitResult>* hits, FVector* dir) override;
|
||||
virtual void CalculateHits(TArray<FHitResult>* hits) override;
|
||||
|
||||
virtual void ProcessHits(TArray<FHitResult> hits, FVector dir) override;
|
||||
virtual void ProcessHits(TArray<FHitResult> hits) override;
|
||||
|
||||
virtual void PlayOnFireAnimations() override;
|
||||
|
||||
|
@ -125,7 +125,7 @@ TSubclassOf<ADecalActor> AWeapon::GetDecalActor()
|
||||
return DecalActor;
|
||||
}
|
||||
|
||||
UNiagaraSystem* AWeapon::GetImpactParticleSystem()
|
||||
UParticleSystem* AWeapon::GetImpactParticleSystem()
|
||||
{
|
||||
return ImpactParticleSystem;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "NakatomiFieldSystemActor.h"
|
||||
#include "WeaponProperties.h"
|
||||
#include "WeaponThrowable.h"
|
||||
#include "NiagaraSystem.h"
|
||||
#include "Weapon.generated.h"
|
||||
|
||||
class ANakatomiCharacter;
|
||||
@ -57,7 +56,7 @@ protected:
|
||||
TSubclassOf<class ADecalActor> DecalActor;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
UNiagaraSystem* ImpactParticleSystem;
|
||||
UParticleSystem* ImpactParticleSystem;
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
@ -106,5 +105,5 @@ public:
|
||||
|
||||
TSubclassOf<class ADecalActor> GetDecalActor();
|
||||
|
||||
UNiagaraSystem* GetImpactParticleSystem();
|
||||
UParticleSystem* GetImpactParticleSystem();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user