parent
d0807c3775
commit
c5d77baa69
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "SelectedUpgrade.h"
|
@ -0,0 +1,34 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Unit.h"
|
||||
|
||||
// Sets default values
|
||||
AUnit::AUnit()
|
||||
{
|
||||
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AUnit::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AUnit::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
|
||||
// Called to bind functionality to input
|
||||
void AUnit::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||
{
|
||||
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UnitUpgrade.h"
|
||||
|
||||
void UUnitUpgrade::ApplyToUnit(AUnit* Unit)
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Upgrade.h"
|
||||
|
||||
TArray<FString> UUpgrade::GetApplicableTags()
|
||||
{
|
||||
return ApplicableTags;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UpgradeSubsystem.h"
|
||||
|
||||
#include "UnitUpgrade.h"
|
||||
|
||||
void UUpgradeSubsystem::ApplyUnitUpgrades(AUnit* Unit)
|
||||
{
|
||||
for (const auto Upgrade : SelectedUpgrades)
|
||||
{
|
||||
UUnitUpgrade* UnitUpgrade = Cast<UUnitUpgrade>(Upgrade.UpgradeData);
|
||||
if(UnitUpgrade != nullptr)
|
||||
{
|
||||
for (const FString Tag : Upgrade.UpgradeData->GetApplicableTags())
|
||||
{
|
||||
if(Unit->UnitTags.Contains(Tag))
|
||||
{
|
||||
UnitUpgrade->ApplyToUnit(Unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UUpgradeSubsystem::ApplyGlobalUpgrades()
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Upgrade.h"
|
||||
#include "SelectedUpgrade.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FSelectedUpgrade
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
UUpgrade* UpgradeData;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int32 TimesSelected;
|
||||
};
|
@ -0,0 +1,63 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Unit.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class SPACEBATTLER_API AUnit : public ACharacter
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this character's properties
|
||||
AUnit();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
// Called to bind functionality to input
|
||||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, Category="Unit Info Copy")
|
||||
double MaxHP;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="State")
|
||||
double HP;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Unit Info Copy")
|
||||
double Attack;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Unit Info Copy")
|
||||
double Range;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Unit Info Copy")
|
||||
double RangedProjectileSpeed;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Unit Info Copy")
|
||||
double RangedProjectileDelay;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Unit Info Copy")
|
||||
int32 RangedProjectileAmount;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Unit Info Copy")
|
||||
double Cooldown;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Unit Info Copy")
|
||||
TArray<FString> UnitTags;
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Unit.h"
|
||||
#include "Upgrade.h"
|
||||
#include "UnitUpgrade.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class SPACEBATTLER_API UUnitUpgrade : public UUpgrade
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
void ApplyToUnit(AUnit* Unit);
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "Upgrade.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class SPACEBATTLER_API UUpgrade : public UPrimaryDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
TArray<FString> GetApplicableTags();
|
||||
|
||||
protected:
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FText Name;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, meta=(MultiLine=true))
|
||||
FText Description;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool Repeatable;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
TArray<FString> ApplicableTags;
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "SelectedUpgrade.h"
|
||||
#include "Unit.h"
|
||||
#include "Subsystems/LocalPlayerSubsystem.h"
|
||||
#include "UpgradeSubsystem.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class SPACEBATTLER_API UUpgradeSubsystem : public ULocalPlayerSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ApplyUnitUpgrades(AUnit* Unit);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ApplyGlobalUpgrades();
|
||||
|
||||
protected:
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int32 BattleTier;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TArray<FSelectedUpgrade> SelectedUpgrades;
|
||||
};
|
Loading…
Reference in new issue