Add Weapon class
This commit is contained in:
parent
686294ab41
commit
d185f032bb
|
@ -0,0 +1,33 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Weapon.h"
|
||||
|
||||
#include "EXPComponent.h"
|
||||
|
||||
// Sets default values
|
||||
AWeapon::AWeapon()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AWeapon::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
GetWorldTimerManager().SetTimer(WeaponTimerHandle, this, &AWeapon::FireWeaponAction, WeaponCooldown, true);
|
||||
UEXPComponent* expcomponent = GetOwner()->GetComponentByClass<UEXPComponent>();
|
||||
if (expcomponent)
|
||||
{
|
||||
expcomponent->OnEXPLevelUp.BindUObject(this, &AWeapon::UpgradeWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
void AWeapon::FireWeaponAction()
|
||||
{
|
||||
}
|
||||
|
||||
void AWeapon::UpgradeWeapon(int newLevel)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Weapon.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class VAMPIRES_API AWeapon : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY()
|
||||
float WeaponCooldown = 1.0f;
|
||||
|
||||
private:
|
||||
FTimerHandle WeaponTimerHandle;
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AWeapon();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void FireWeaponAction();
|
||||
|
||||
UFUNCTION()
|
||||
virtual void UpgradeWeapon(int newLevel);
|
||||
};
|
Loading…
Reference in New Issue