Redesign
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
Content/Assets/Blocks/Textures/SM_Block_Explosive_Normal.uasset
Normal file
BIN
Content/Assets/Blocks/Textures/SM_Block_Explosive_Normal.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Assets/Blocks/Textures/SM_Block_Moving_BaseColor.uasset
Normal file
BIN
Content/Assets/Blocks/Textures/SM_Block_Moving_BaseColor.uasset
Normal file
Binary file not shown.
BIN
Content/Assets/Blocks/Textures/SM_Block_Moving_Normal.uasset
Normal file
BIN
Content/Assets/Blocks/Textures/SM_Block_Moving_Normal.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Assets/Blocks/Textures/SM_Block_Multi_BaseColor.uasset
Normal file
BIN
Content/Assets/Blocks/Textures/SM_Block_Multi_BaseColor.uasset
Normal file
Binary file not shown.
BIN
Content/Assets/Blocks/Textures/SM_Block_Multi_Normal.uasset
Normal file
BIN
Content/Assets/Blocks/Textures/SM_Block_Multi_Normal.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Assets/Blocks/Textures/SM_Block_Singlehit_Normal.uasset
Normal file
BIN
Content/Assets/Blocks/Textures/SM_Block_Singlehit_Normal.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/BP_PowerupBase.uasset
Normal file
BIN
Content/Blueprints/BP_PowerupBase.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/Blocks/BP_Block_Basic.uasset
Normal file
BIN
Content/Blueprints/Blocks/BP_Block_Basic.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/Blocks/BP_Block_Gummy.uasset
Normal file
BIN
Content/Blueprints/Blocks/BP_Block_Gummy.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/Blocks/BP_Block_Portal.uasset
Normal file
BIN
Content/Blueprints/Blocks/BP_Block_Portal.uasset
Normal file
Binary file not shown.
BIN
Content/Blueprints/Blocks/BP_Block_Regenerative.uasset
Normal file
BIN
Content/Blueprints/Blocks/BP_Block_Regenerative.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprints/Fireworks/BP_Impact.uasset
Normal file
BIN
Content/Blueprints/Fireworks/BP_Impact.uasset
Normal file
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.
Binary file not shown.
Binary file not shown.
BIN
Content/Levels/L_LevelBase.uasset
Normal file
BIN
Content/Levels/L_LevelBase.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Materials/M_BG_Sphere.uasset
Normal file
BIN
Content/Materials/M_BG_Sphere.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Materials/M_Block_Explosive.uasset
Normal file
BIN
Content/Materials/M_Block_Explosive.uasset
Normal file
Binary file not shown.
BIN
Content/Materials/M_Block_Moving.uasset
Normal file
BIN
Content/Materials/M_Block_Moving.uasset
Normal file
Binary file not shown.
BIN
Content/Materials/M_Block_Multihit.uasset
Normal file
BIN
Content/Materials/M_Block_Multihit.uasset
Normal file
Binary file not shown.
BIN
Content/Materials/M_Block_Regenerative.uasset
Normal file
BIN
Content/Materials/M_Block_Regenerative.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,6 +21,9 @@ public:
|
|||||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||||
float Health = 100.0f;
|
float Health = 100.0f;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly)
|
||||||
|
int32 Index = 0;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly)
|
UPROPERTY(BlueprintReadOnly)
|
||||||
float InitialHealth;
|
float InitialHealth;
|
||||||
|
|
||||||
|
|||||||
@@ -14,35 +14,24 @@ UENUM(BlueprintType)
|
|||||||
enum FireworksCategory
|
enum FireworksCategory
|
||||||
{
|
{
|
||||||
Firecracker UMETA(DisplayName="Firecracker"),
|
Firecracker UMETA(DisplayName="Firecracker"),
|
||||||
Volcano UMETA(DisplayName = "Volcano"),
|
|
||||||
RomanFire UMETA(DisplayName = "RomanFire"),
|
RomanFire UMETA(DisplayName = "RomanFire"),
|
||||||
Rocket UMETA(DisplayName = "Rocket"),
|
Rocket UMETA(DisplayName = "Rocket"),
|
||||||
Battery UMETA(DisplayName = "Battery"),
|
|
||||||
None UMETA(DisplayName="None")
|
None UMETA(DisplayName="None")
|
||||||
};
|
};
|
||||||
|
|
||||||
UENUM(BlueprintType)
|
UENUM(BlueprintType)
|
||||||
enum Firework
|
enum Firework
|
||||||
{
|
{
|
||||||
RedDragon UMETA(DisplayName = "RedDragon"),
|
Impact UMETA(DisplayName = "Impact"),
|
||||||
Pirate UMETA(DisplayName = "Pirate"),
|
Timed UMETA(DisplayName = "Timed"),
|
||||||
DoubleTrouble UMETA(DisplayName = "DoubleTrouble"),
|
Sticky UMETA(DisplayName = "Sticky"),
|
||||||
InstantDeath UMETA(DisplayName = "InstantDeath"),
|
Cluster UMETA(DisplayName = "Cluster"),
|
||||||
LongFuse UMETA(DisplayName = "LongFuse"),
|
ImpactRocket UMETA(DisplayName = "ImpactRocket"),
|
||||||
WhiteWidow UMETA(DisplayName = "WhiteWidow"),
|
TimedRocket UMETA(DisplayName = "TimedRocket"),
|
||||||
GreenGoblin UMETA(DisplayName = "GreenGoblin"),
|
ClusterRocket UMETA(DisplayName = "ClusterRocket"),
|
||||||
TwelveGauge UMETA(DisplayName = "TwelveGauge"),
|
StickyRocket UMETA(DisplayName = "StickyRocket"),
|
||||||
Comet5000 UMETA(DisplayName = "Comet5000"),
|
GuidedRocket UMETA(DisplayName = "GuidedRocket"),
|
||||||
TwentyMegaton UMETA(DisplayName = "TwentyMegaton"),
|
|
||||||
Whistle UMETA(DisplayName = "Whistle"),
|
|
||||||
RedHornet UMETA(DisplayName = "RedHornet"),
|
|
||||||
BigDaddy UMETA(DisplayName = "BigDaddy"),
|
|
||||||
Kamikaze UMETA(DisplayName = "Kamikaze"),
|
|
||||||
Commando3000 UMETA(DisplayName = "Commando3000"),
|
|
||||||
AtomBomb UMETA(DisplayName = "AtomBomb"),
|
|
||||||
QuadrupleBazooka UMETA(DisplayName = "QuadrupleBazooka"),
|
|
||||||
RocketLauncher UMETA(DisplayName = "RocketLauncher"),
|
|
||||||
Panzerfaust UMETA(DisplayName = "Panzerfaust"),
|
|
||||||
Lighter UMETA(DisplayName = "Lighter"),
|
Lighter UMETA(DisplayName = "Lighter"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -71,26 +60,6 @@ struct FIREWORKDUELS_API FFireworkData : public FTableRowBase
|
|||||||
UTexture2D* Icon = nullptr;
|
UTexture2D* Icon = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inventory Firework Entry
|
|
||||||
USTRUCT(BlueprintType)
|
|
||||||
struct FIREWORKDUELS_API FFireworkEntry
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
FFireworkEntry(){}
|
|
||||||
|
|
||||||
FFireworkEntry(FFireworkData Data, int32 ThisQuantity)
|
|
||||||
{
|
|
||||||
FireworkData = Data;
|
|
||||||
Quantity = ThisQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
FFireworkData FireworkData;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
int32 Quantity;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
@@ -99,7 +68,7 @@ struct FIREWORKDUELS_API FInventory
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TArray<FFireworkEntry> Items;
|
TArray<FFireworkData> Items;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "WickComponent.h"
|
#include "WickComponent.h"
|
||||||
#include "NiagaraComponent.h"
|
#include "NiagaraComponent.h"
|
||||||
|
#include "Kismet/KismetSystemLibrary.h"
|
||||||
#include "FireworkBase.generated.h"
|
#include "FireworkBase.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
@@ -37,6 +38,9 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
bool IsBurning;
|
bool IsBurning;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
float DamageRadius = 25.f;
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
bool IsDummyObject;
|
bool IsDummyObject;
|
||||||
|
|
||||||
@@ -60,5 +64,4 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
|
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
|
||||||
void ExplodeEffects();
|
void ExplodeEffects();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class FireworkDuels : ModuleRules
|
|||||||
{
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "Niagara", "UMG" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "Niagara", "UMG", "Paper2D" });
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
|
|
||||||
|
|||||||
@@ -238,18 +238,6 @@ bool AFireworksPawn::Drop(EControllerHand Hand)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add firecracker to inventory
|
|
||||||
void AFireworksPawn::AddToInventory(const FFireworkEntry& Entry)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove firecracker from inventory
|
|
||||||
void AFireworksPawn::RemoveFromInventory(const FFireworkData& Item)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable laser on specific hand
|
// Enable laser on specific hand
|
||||||
void AFireworksPawn::EnableLaserOnHand(EControllerHand Hand)
|
void AFireworksPawn::EnableLaserOnHand(EControllerHand Hand)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ public:
|
|||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite)
|
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||||
FInventory Inventory;
|
TArray<FFireworkData> Inventory;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite)
|
UPROPERTY(BlueprintReadWrite)
|
||||||
APickableObject* HeldObject_R;
|
APickableObject* HeldObject_R;
|
||||||
@@ -123,9 +123,6 @@ public:
|
|||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||||
FHitResult CurrentLaserHitR;
|
FHitResult CurrentLaserHitR;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
AActor* TeleportVisual;
|
|
||||||
|
|
||||||
// How much velocity samples should be recorded for throwing direction approximation
|
// How much velocity samples should be recorded for throwing direction approximation
|
||||||
UPROPERTY(EditDefaultsOnly, Category = "Throwing")
|
UPROPERTY(EditDefaultsOnly, Category = "Throwing")
|
||||||
int32 VelocitySamples = 5;
|
int32 VelocitySamples = 5;
|
||||||
@@ -159,14 +156,6 @@ public:
|
|||||||
// Approximate throw velocity
|
// Approximate throw velocity
|
||||||
FVector ApproximateThrowVelocity(EControllerHand Hand);
|
FVector ApproximateThrowVelocity(EControllerHand Hand);
|
||||||
|
|
||||||
// Add firecracker to inventory
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void AddToInventory(const FFireworkEntry& Entry);
|
|
||||||
|
|
||||||
// Remove firecracker from inventory
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void RemoveFromInventory(const FFireworkData& Item);
|
|
||||||
|
|
||||||
// ABA ABA
|
// ABA ABA
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void EnableLaserOnHand(EControllerHand Hand);
|
void EnableLaserOnHand(EControllerHand Hand);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
UStaticMesh* StaticMesh;
|
UStaticMesh* StaticMesh;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly)
|
UPROPERTY(BlueprintReadOnly)
|
||||||
FFireworkEntry FireworkEntryData;
|
FFireworkData FireworkData;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
float TargetDistanceAlongSpline;
|
float TargetDistanceAlongSpline;
|
||||||
|
|||||||
@@ -1,71 +1 @@
|
|||||||
#include "InventoryManager.h"
|
#include "InventoryManager.h"
|
||||||
|
|
||||||
// Add item to inventory
|
|
||||||
void AInventoryManager::AddToInventory(const FFireworkData& Item, const int32& Quantity, const APawn* Pawn)
|
|
||||||
{
|
|
||||||
FInventory* InventoryToUpdate = Inventory.Find(Pawn);
|
|
||||||
|
|
||||||
// If there's no inventory associated with supplied pawn, create one
|
|
||||||
if (!InventoryToUpdate)
|
|
||||||
{
|
|
||||||
InventoryToUpdate = new FInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
FFireworkEntry* ItemToUpdate = InventoryToUpdate->Items.FindByPredicate([&](const FFireworkEntry& ThisItem)
|
|
||||||
{
|
|
||||||
return ThisItem.FireworkData.Firework == Item.Firework;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (ItemToUpdate == nullptr) {
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("ItemToUpdate not found - creating one"));
|
|
||||||
ItemToUpdate = new FFireworkEntry(Item, Quantity);
|
|
||||||
InventoryToUpdate->Items.Add(*ItemToUpdate);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("ItemToUpdate was found, updating..."));
|
|
||||||
ItemToUpdate->Quantity += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove item from inventory
|
|
||||||
void AInventoryManager::RemoveFromInventory(const FFireworkData& Item, const APawn* Pawn)
|
|
||||||
{
|
|
||||||
// code
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove all items of a specified player from inventory (for example if he quits match mid game)
|
|
||||||
void AInventoryManager::RemovePlayerItems(const APawn* Pawn)
|
|
||||||
{
|
|
||||||
// code
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get joint inventory of all players
|
|
||||||
FInventory AInventoryManager::GetInventory()
|
|
||||||
{
|
|
||||||
FInventory Joint;
|
|
||||||
TArray<APawn*> Pawns;
|
|
||||||
Inventory.GetKeys(Pawns);
|
|
||||||
|
|
||||||
for (int32 i = 0; i < Pawns.Num(); i++)
|
|
||||||
{
|
|
||||||
FInventory* ThisInventory = Inventory.Find(Pawns[i]);
|
|
||||||
for (int32 f = 0; f < ThisInventory->Items.Num(); f++)
|
|
||||||
{
|
|
||||||
// Check if items of this category already exist in joint inventory
|
|
||||||
FFireworkEntry* ItemToUpdate = Joint.Items.FindByPredicate([&](const FFireworkEntry& ThisItem) {
|
|
||||||
return ThisItem.FireworkData.Firework == ThisInventory->Items[i].FireworkData.Firework;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (ItemToUpdate == nullptr) {
|
|
||||||
ItemToUpdate = &ThisInventory->Items[i];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ItemToUpdate->Quantity += ThisInventory->Items[i].Quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
Joint.Items.Add(*ItemToUpdate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Joint;
|
|
||||||
}
|
|
||||||
@@ -16,17 +16,4 @@ class FIREWORKDUELS_API AInventoryManager : public AActor
|
|||||||
public:
|
public:
|
||||||
UPROPERTY(BlueprintReadOnly)
|
UPROPERTY(BlueprintReadOnly)
|
||||||
TMap<APawn*, FInventory> Inventory;
|
TMap<APawn*, FInventory> Inventory;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void AddToInventory(const FFireworkData& Item, const int32& Quantity, const APawn* Pawn);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void RemoveFromInventory(const FFireworkData& Item, const APawn* Pawn);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void RemovePlayerItems(const APawn* Pawn);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
FInventory GetInventory();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
27
Source/FireworkDuels/Private/LevelTemplate.cpp
Normal file
27
Source/FireworkDuels/Private/LevelTemplate.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
|
#include "LevelTemplate.h"
|
||||||
|
|
||||||
|
// Sets default values
|
||||||
|
ALevelTemplate::ALevelTemplate()
|
||||||
|
{
|
||||||
|
// Set this actor 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 ALevelTemplate::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
void ALevelTemplate::Tick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
27
Source/FireworkDuels/Private/Powerup.cpp
Normal file
27
Source/FireworkDuels/Private/Powerup.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Powerup.h"
|
||||||
|
|
||||||
|
// Sets default values
|
||||||
|
APowerup::APowerup()
|
||||||
|
{
|
||||||
|
// Set this actor 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 APowerup::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
void APowerup::Tick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
39
Source/FireworkDuels/Public/LevelTemplate.h
Normal file
39
Source/FireworkDuels/Public/LevelTemplate.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
// All rights reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "PaperTileMapComponent.h"
|
||||||
|
#include "LevelTemplate.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class FIREWORKDUELS_API ALevelTemplate : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this actor's properties
|
||||||
|
ALevelTemplate();
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
UPaperTileMapComponent* Template;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
int32 OneStarTarget = 180;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
int32 TwoStarTarget = 120;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
int32 ThreeStarTarget = 60;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Called every frame
|
||||||
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
};
|
||||||
26
Source/FireworkDuels/Public/Powerup.h
Normal file
26
Source/FireworkDuels/Public/Powerup.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// All rights reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "Powerup.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class FIREWORKDUELS_API APowerup : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this actor's properties
|
||||||
|
APowerup();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Called every frame
|
||||||
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
};
|
||||||
@@ -11,16 +11,24 @@ ASpawnManager::ASpawnManager()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASpawnManager::GenerateBoard() {
|
void ASpawnManager::GenerateBoard(TSubclassOf<ALevelTemplate> &Template) {
|
||||||
int32 ClassesCount = SpawnableClasses.Num();
|
|
||||||
FVector ActorLocation = this->GetActorLocation();
|
FVector ActorLocation = this->GetActorLocation();
|
||||||
|
CurrentLevel = GetWorld()->SpawnActor<ALevelTemplate>(Template, this->GetActorTransform());
|
||||||
|
UPaperTileMapComponent* Tilemap = CurrentLevel->Template;
|
||||||
|
|
||||||
|
TArray<TSubclassOf<ABuildingBlock>> Classes;
|
||||||
|
|
||||||
for (int32 i = 0; i < BlocksY; i++) {
|
for (int32 i = 0; i < BlocksY; i++) {
|
||||||
for (int32 o = 0; o < BlocksX; o++) {
|
for (int32 o = 0; o < BlocksX; o++) {
|
||||||
int32 RandomIndex = FMath::RandRange(0, ClassesCount - 1);
|
// Make transform
|
||||||
FTransform SpawnTransform;
|
FTransform SpawnTransform;
|
||||||
SpawnTransform.SetLocation(FVector((ActorLocation.X - (Distance * BlocksX / 2) + (o * Distance)), (ActorLocation.Y - (Distance * (BlocksY / 2)) + (i * Distance)), ActorLocation.Z));
|
SpawnTransform.SetLocation(FVector((ActorLocation.X - (Distance * BlocksX / 2) + (o * Distance)), (ActorLocation.Y - (Distance * (BlocksY / 2)) + (i * Distance)), ActorLocation.Z));
|
||||||
GetWorld()->SpawnActor<ABuildingBlock>(SpawnableClasses[RandomIndex], SpawnTransform);
|
|
||||||
|
// Spawn block
|
||||||
|
int32 TileId = Tilemap->GetTile(i, o, 0).GetTileIndex();
|
||||||
|
TSubclassOf<ABuildingBlock> TileClass = *BlockTemplates.Find(TileId);
|
||||||
|
ABuildingBlock* ThisBlock = GetWorld()->SpawnActor<ABuildingBlock>(TileClass, SpawnTransform);
|
||||||
|
ThisBlock->Index = (10 * i) + o;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "BuildingBlock.h"
|
#include "BuildingBlock.h"
|
||||||
#include "Math/UnrealMathUtility.h"
|
#include "Math/UnrealMathUtility.h"
|
||||||
|
#include "LevelTemplate.h"
|
||||||
#include "SpawnManager.generated.h"
|
#include "SpawnManager.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
@@ -19,20 +20,23 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
float Distance = 45.0f;
|
float Distance = 45.0f;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||||
int32 BlocksX = 5;
|
int32 BlocksX = 10;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||||
int32 BlocksY = 5;
|
int32 BlocksY = 10;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TArray<TSubclassOf<ABuildingBlock>> SpawnableClasses;
|
ALevelTemplate* CurrentLevel;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
TMap<int32, TSubclassOf<ABuildingBlock>> BlockTemplates;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, CallInEditor)
|
UFUNCTION(BlueprintCallable, CallInEditor)
|
||||||
void GenerateBoard();
|
void GenerateBoard(TSubclassOf<ALevelTemplate> &Template);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user