Add Gun Weapon
This commit is contained in:
parent
d9dba81c7e
commit
66a07e621d
BIN
Content/Weapons/PhieraDerTuphello/BP_PhieraDerTuphelloWeapon.uasset (Stored with Git LFS)
Normal file
BIN
Content/Weapons/PhieraDerTuphello/BP_PhieraDerTuphelloWeapon.uasset (Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -0,0 +1,42 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "GunWeapon.h"
|
||||||
|
|
||||||
|
AGunWeapon::AGunWeapon()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGunWeapon::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AGunWeapon::FireWeaponAction_Implementation()
|
||||||
|
{
|
||||||
|
Super::FireWeaponAction_Implementation();
|
||||||
|
|
||||||
|
if (IsValid(ProjectileTemplate))
|
||||||
|
{
|
||||||
|
FActorSpawnParameters actorSpawnParameters;
|
||||||
|
actorSpawnParameters.Owner = this;
|
||||||
|
actorSpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
|
actorSpawnParameters.TransformScaleMethod = ESpawnActorScaleMethod::MultiplyWithRoot;
|
||||||
|
|
||||||
|
AProjectile* projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileTemplate, GetOwner()->GetTransform(),
|
||||||
|
actorSpawnParameters);
|
||||||
|
projectile->TargetDirection = FVector(1.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileTemplate, GetOwner()->GetTransform(),
|
||||||
|
actorSpawnParameters);
|
||||||
|
projectile->TargetDirection = FVector(-1.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileTemplate, GetOwner()->GetTransform(),
|
||||||
|
actorSpawnParameters);
|
||||||
|
projectile->TargetDirection = FVector(1.0f, -1.0f, 0.0f);
|
||||||
|
|
||||||
|
projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileTemplate, GetOwner()->GetTransform(),
|
||||||
|
actorSpawnParameters);
|
||||||
|
projectile->TargetDirection = FVector(-1.0f, -1.0f, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "ProjectileWeapon.h"
|
||||||
|
#include "GunWeapon.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class VAMPIRES_API AGunWeapon : public AProjectileWeapon
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
AGunWeapon();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void FireWeaponAction_Implementation() override;
|
||||||
|
};
|
Loading…
Reference in New Issue