Init
This commit is contained in:
35
Source/FireworkDuels/BuildingBlock.cpp
Normal file
35
Source/FireworkDuels/BuildingBlock.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "BuildingBlock.h"
|
||||
|
||||
// Sets default values
|
||||
ABuildingBlock::ABuildingBlock()
|
||||
{
|
||||
// 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;
|
||||
InitialHealth = Health;
|
||||
|
||||
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
|
||||
}
|
||||
|
||||
void ABuildingBlock::DepleteHealth(float Amount) {
|
||||
Health =- Amount;
|
||||
|
||||
if (Health <= 0.f) {
|
||||
DestroyBlock();
|
||||
}
|
||||
else {
|
||||
uint8 DestructionLevel = 0;
|
||||
if (Health <= InitialHealth * 0.66f) {
|
||||
if (Health <= InitialHealth * 0.33f) {
|
||||
DestructionLevel = 2;
|
||||
}
|
||||
else {
|
||||
DestructionLevel = 1;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateDestructionLevel(DestructionLevel);
|
||||
}
|
||||
}
|
||||
36
Source/FireworkDuels/BuildingBlock.h
Normal file
36
Source/FireworkDuels/BuildingBlock.h
Normal file
@@ -0,0 +1,36 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "BuildingBlock.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API ABuildingBlock : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
ABuildingBlock();
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
UStaticMeshComponent* StaticMesh;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float Health = 100;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
float InitialHealth;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DepleteHealth(float Amount);
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void UpdateDestructionLevel(uint8 Level);
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void DestroyBlock();
|
||||
|
||||
};
|
||||
34
Source/FireworkDuels/CrateComponent.cpp
Normal file
34
Source/FireworkDuels/CrateComponent.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
// All rights reserved.
|
||||
|
||||
|
||||
#include "CrateComponent.h"
|
||||
|
||||
// Sets default values for this component's properties
|
||||
UCrateComponent::UCrateComponent()
|
||||
{
|
||||
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
|
||||
// off to improve performance if you don't need them.
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
// Called when the game starts
|
||||
void UCrateComponent::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
// ...
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Called every frame
|
||||
void UCrateComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||
{
|
||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
28
Source/FireworkDuels/CrateComponent.h
Normal file
28
Source/FireworkDuels/CrateComponent.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/SceneComponent.h"
|
||||
#include "CrateComponent.generated.h"
|
||||
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
class FIREWORKDUELS_API UCrateComponent : public USceneComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this component's properties
|
||||
UCrateComponent();
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||
|
||||
|
||||
};
|
||||
4
Source/FireworkDuels/CustomDataTypes.cpp
Normal file
4
Source/FireworkDuels/CustomDataTypes.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "CustomDataTypes.h"
|
||||
124
Source/FireworkDuels/CustomDataTypes.h
Normal file
124
Source/FireworkDuels/CustomDataTypes.h
Normal file
@@ -0,0 +1,124 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "FireworkBase.h"
|
||||
#include "BuildingBlock.h"
|
||||
#include "Engine/Texture.h"
|
||||
#include "Engine/World.h"
|
||||
#include "Engine/DataTable.h"
|
||||
#include "CustomDataTypes.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum FireworksCategory
|
||||
{
|
||||
Firecracker UMETA(DisplayName="Firecracker"),
|
||||
Volcano UMETA(DisplayName = "Volcano"),
|
||||
RomanFire UMETA(DisplayName = "RomanFire"),
|
||||
Rocket UMETA(DisplayName = "Rocket"),
|
||||
Battery UMETA(DisplayName = "Battery"),
|
||||
None UMETA(DisplayName="None")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum Firework
|
||||
{
|
||||
RedDragon UMETA(DisplayName = "RedDragon"),
|
||||
Pirate UMETA(DisplayName = "Pirate"),
|
||||
DoubleTrouble UMETA(DisplayName = "DoubleTrouble"),
|
||||
InstantDeath UMETA(DisplayName = "InstantDeath"),
|
||||
LongFuse UMETA(DisplayName = "LongFuse"),
|
||||
WhiteWidow UMETA(DisplayName = "WhiteWidow"),
|
||||
GreenGoblin UMETA(DisplayName = "GreenGoblin"),
|
||||
TwelveGauge UMETA(DisplayName = "TwelveGauge"),
|
||||
Comet5000 UMETA(DisplayName = "Comet5000"),
|
||||
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"),
|
||||
};
|
||||
|
||||
// Firework data
|
||||
USTRUCT(BlueprintType)
|
||||
struct FIREWORKDUELS_API FFireworkData : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TEnumAsByte<Firework> Firework;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText Description;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TEnumAsByte<FireworksCategory> Category;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 Price;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TSubclassOf<AFireworkBase> Class;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
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
|
||||
USTRUCT(BlueprintType)
|
||||
struct FIREWORKDUELS_API FInventory
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FFireworkEntry> Items;
|
||||
};
|
||||
|
||||
|
||||
// Level Data
|
||||
USTRUCT(BlueprintType)
|
||||
struct FIREWORKDUELS_API FLevelData : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TSoftObjectPtr<UWorld> Level;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TSoftObjectPtr<UTexture2D> LevelThumbnail;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText LevelName;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText Description;
|
||||
|
||||
};
|
||||
58
Source/FireworkDuels/FireworkBase.cpp
Normal file
58
Source/FireworkDuels/FireworkBase.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "FireworkBase.h"
|
||||
|
||||
// Sets default values
|
||||
AFireworkBase::AFireworkBase()
|
||||
{
|
||||
// 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;
|
||||
|
||||
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Root"));
|
||||
//StaticMesh = RootComponent;
|
||||
|
||||
|
||||
if (!IsDummyObject) {
|
||||
WickComponent = CreateDefaultSubobject<UWickComponent>(TEXT("WickComponent"));
|
||||
WickComponent->SetupAttachment(RootComponent);
|
||||
WickComponent->SetMobility(EComponentMobility::Movable);
|
||||
WickCollision = CreateDefaultSubobject<UCapsuleComponent>(TEXT("WickCollision"));
|
||||
WickCollision->SetupAttachment(RootComponent);
|
||||
WickEmitter = CreateDefaultSubobject<UNiagaraComponent>(TEXT("WickEmitter"));
|
||||
WickEmitter->SetupAttachment(RootComponent);
|
||||
WickComponent->EmitterReference = WickEmitter;
|
||||
}
|
||||
}
|
||||
|
||||
void AFireworkBase::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
}
|
||||
|
||||
void AFireworkBase::Tick(float DeltaTime)
|
||||
{
|
||||
if (IsBurning)
|
||||
{
|
||||
WickRemainingTime -= DeltaTime;
|
||||
WickComponent->UpdateWickBurnEffects((WickBurningTime - WickRemainingTime) / WickBurningTime);
|
||||
|
||||
if (WickRemainingTime <= 0.f)
|
||||
{
|
||||
Explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AFireworkBase::SetFire()
|
||||
{
|
||||
WickRemainingTime = WickBurningTime;
|
||||
WickEmitter->Activate(true);
|
||||
IsBurning = true;
|
||||
}
|
||||
|
||||
void AFireworkBase::Explode()
|
||||
{
|
||||
IsBurning = false;
|
||||
ExplodeEffects();
|
||||
}
|
||||
64
Source/FireworkDuels/FireworkBase.h
Normal file
64
Source/FireworkDuels/FireworkBase.h
Normal file
@@ -0,0 +1,64 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "PickableObject.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "WickComponent.h"
|
||||
#include "NiagaraComponent.h"
|
||||
#include "FireworkBase.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AFireworkBase : public APickableObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
virtual void Tick(float DeltaTime);
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AFireworkBase();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UWickComponent* WickComponent;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UCapsuleComponent* WickCollision;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UNiagaraComponent* WickEmitter;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool IsBurning;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
bool IsDummyObject;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
float WickBurningTime;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
float PostWickTime;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
int32 MultiShotCount;
|
||||
|
||||
UPROPERTY()
|
||||
float WickRemainingTime;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void SetFire();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void Explode();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
|
||||
void ExplodeEffects();
|
||||
|
||||
};
|
||||
23
Source/FireworkDuels/FireworkDuels.Build.cs
Normal file
23
Source/FireworkDuels/FireworkDuels.Build.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class FireworkDuels : ModuleRules
|
||||
{
|
||||
public FireworkDuels(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "Niagara", "UMG" });
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
||||
// Uncomment if you are using Slate UI
|
||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||
|
||||
// Uncomment if you are using online features
|
||||
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
|
||||
|
||||
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
|
||||
}
|
||||
}
|
||||
6
Source/FireworkDuels/FireworkDuels.cpp
Normal file
6
Source/FireworkDuels/FireworkDuels.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "FireworkDuels.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, FireworkDuels, "FireworkDuels");
|
||||
6
Source/FireworkDuels/FireworkDuels.h
Normal file
6
Source/FireworkDuels/FireworkDuels.h
Normal file
@@ -0,0 +1,6 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
5
Source/FireworkDuels/FireworkDuelsGameModeBase.cpp
Normal file
5
Source/FireworkDuels/FireworkDuelsGameModeBase.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
|
||||
#include "FireworkDuelsGameModeBase.h"
|
||||
|
||||
17
Source/FireworkDuels/FireworkDuelsGameModeBase.h
Normal file
17
Source/FireworkDuels/FireworkDuelsGameModeBase.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "FireworkDuelsGameModeBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AFireworkDuelsGameModeBase : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
371
Source/FireworkDuels/FireworksPawn.cpp
Normal file
371
Source/FireworkDuels/FireworksPawn.cpp
Normal file
@@ -0,0 +1,371 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "FireworksPawn.h"
|
||||
|
||||
// Sets default values
|
||||
AFireworksPawn::AFireworksPawn()
|
||||
{
|
||||
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
PawnRoot = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
|
||||
RootComponent = PawnRoot;
|
||||
CameraRoot = CreateDefaultSubobject<USceneComponent>(TEXT("Camera Root"));
|
||||
CameraRoot->SetupAttachment(PawnRoot);
|
||||
VRCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("VR Camera"));
|
||||
VRCamera->SetupAttachment(CameraRoot);
|
||||
|
||||
MotionControllerR = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("MotionControllerR"));
|
||||
MotionControllerR->SetupAttachment(PawnRoot);
|
||||
MotionControllerR->MotionSource = FName(TEXT("Right"));
|
||||
MotionControllerL = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("MotionControllerL"));
|
||||
MotionControllerL->SetupAttachment(PawnRoot);
|
||||
MotionControllerL->MotionSource = FName(TEXT("Left"));
|
||||
|
||||
LeftHandMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("LeftHandMesh"));
|
||||
LeftHandMesh->SetupAttachment(MotionControllerL);
|
||||
RightHandMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("RightHandMesh"));
|
||||
RightHandMesh->SetupAttachment(MotionControllerR);
|
||||
|
||||
RightHandCollision = CreateDefaultSubobject<USphereComponent>(TEXT("RightHandCollision"));
|
||||
RightHandCollision->SetupAttachment(RightHandMesh);
|
||||
RightHandCollision->SetSphereRadius(10.0f, false);
|
||||
LeftHandCollision = CreateDefaultSubobject<USphereComponent>(TEXT("LeftHandCollision"));
|
||||
LeftHandCollision->SetupAttachment(LeftHandMesh);
|
||||
LeftHandCollision->SetSphereRadius(10.0f, false);
|
||||
|
||||
WidgetInteractionL = CreateDefaultSubobject<UWidgetInteractionComponent>(TEXT("WidgetInteraction_L"));
|
||||
WidgetInteractionL->SetupAttachment(LeftHandMesh);
|
||||
WidgetInteractionR = CreateDefaultSubobject<UWidgetInteractionComponent>(TEXT("WidgetInteraction_R"));
|
||||
WidgetInteractionR->SetupAttachment(RightHandMesh);
|
||||
|
||||
LaserL = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("LaserL"));
|
||||
LaserL->SetupAttachment(WidgetInteractionL);
|
||||
LaserR = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("LaserR"));
|
||||
LaserR->SetupAttachment(WidgetInteractionR);
|
||||
|
||||
}
|
||||
|
||||
// Sample Hand Velocities for throw approximation
|
||||
void AFireworksPawn::SampleHandVelocities()
|
||||
{
|
||||
// Left hand
|
||||
if (IsGrabbingL)
|
||||
{
|
||||
VelocitySamples_L.Add(LeftHandCollision->GetPhysicsLinearVelocity());
|
||||
if (VelocitySamples_L.Num() > VelocitySamples)
|
||||
{
|
||||
VelocitySamples_L.RemoveAt(0, 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Right hand
|
||||
if (IsGrabbingR)
|
||||
{
|
||||
VelocitySamples_R.Add(RightHandCollision->GetPhysicsLinearVelocity());
|
||||
if (VelocitySamples_R.Num() > VelocitySamples)
|
||||
{
|
||||
VelocitySamples_R.RemoveAt(0, 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AFireworksPawn::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
CameraRoot->AttachToComponent(PawnRoot, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
VRCamera->AttachToComponent(CameraRoot, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
MotionControllerR->AttachToComponent(PawnRoot, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
MotionControllerL->AttachToComponent(PawnRoot, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
LeftHandMesh->AttachToComponent(MotionControllerL, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
RightHandMesh->AttachToComponent(MotionControllerR, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
RightHandCollision->AttachToComponent(RightHandMesh, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
|
||||
LeftHandCollision->AttachToComponent(LeftHandMesh, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
|
||||
WidgetInteractionL->AttachToComponent(LeftHandMesh, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
WidgetInteractionR->AttachToComponent(RightHandMesh, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
LaserL->AttachToComponent(WidgetInteractionL, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
|
||||
LaserR->AttachToComponent(WidgetInteractionR, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AFireworksPawn::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
SampleHandVelocities();
|
||||
TryUpdateLasers();
|
||||
TryUpdateTeleportVisual();
|
||||
}
|
||||
|
||||
// Called to bind functionality to input
|
||||
void AFireworksPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||
{
|
||||
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
||||
|
||||
}
|
||||
|
||||
// Setup grab attachment
|
||||
void AFireworksPawn::SetupGrabAttachment(EControllerHand Hand) {
|
||||
FName Socket = Hand == EControllerHand::Left ? TEXT("SocketL") : TEXT("SocketR");
|
||||
APickableObject* HeldObject = Hand == EControllerHand::Left ? HeldObject_L : HeldObject_R;
|
||||
|
||||
FTransform HeldObjectTransformLocal = HeldObject->StaticMesh->GetSocketTransform(Socket, ERelativeTransformSpace::RTS_Actor);
|
||||
|
||||
// Set new values
|
||||
FTransform NewTransform;
|
||||
NewTransform.SetScale3D(FVector(1.f, 1.f, 1.f));
|
||||
NewTransform.SetLocation(FVector(0.f, 0.f, 0.f));
|
||||
NewTransform.SetRotation(HeldObjectTransformLocal.GetRotation().Inverse());
|
||||
|
||||
// Set new transform
|
||||
HeldObject->SetActorRelativeTransform(NewTransform);
|
||||
HeldObject->AddActorLocalOffset(HeldObjectTransformLocal.GetLocation() * -1.f);
|
||||
}
|
||||
|
||||
// Try grab
|
||||
bool AFireworksPawn::TryGrab(EControllerHand Hand)
|
||||
{
|
||||
if (Hand == EControllerHand::Left) {
|
||||
// Left hand
|
||||
if (IsValid(HeldObject_L)) {
|
||||
return false;
|
||||
}
|
||||
if (!IsValid(HoveredActorL)) {
|
||||
return false;
|
||||
}
|
||||
HoveredActorL->StaticMesh->SetSimulatePhysics(false);
|
||||
HoveredActorL->StaticMesh->SetRenderCustomDepth(false);
|
||||
HeldObject_L = HoveredActorL;
|
||||
HeldObject_L->AttachToComponent(MotionControllerL, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
SetupGrabAttachment(EControllerHand::Left);
|
||||
HeldObject_L->SetInstigator(this);
|
||||
IsGrabbingL = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// Right hand
|
||||
if (IsValid(HeldObject_R)) {
|
||||
return false;
|
||||
}
|
||||
if (!IsValid(HoveredActorR)) {
|
||||
return false;
|
||||
}
|
||||
HoveredActorR->StaticMesh->SetSimulatePhysics(false);
|
||||
HoveredActorR->StaticMesh->SetRenderCustomDepth(false);
|
||||
HeldObject_R = HoveredActorR;
|
||||
HeldObject_R->StaticMesh->AttachToComponent(MotionControllerR, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
SetupGrabAttachment(EControllerHand::Right);
|
||||
HeldObject_R->SetInstigator(this);
|
||||
IsGrabbingR = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Approximate Throw Velocity
|
||||
FVector AFireworksPawn::ApproximateThrowVelocity(EControllerHand Hand)
|
||||
{
|
||||
TArray<FVector> SampledVelocities = Hand == EControllerHand::Left ? VelocitySamples_L : VelocitySamples_R;
|
||||
FVector ApproximatedVelocity;
|
||||
|
||||
if (!SampledVelocities.IsEmpty()) {
|
||||
// TODO: discard shortest and longest vector, but first check if average works
|
||||
|
||||
// Calculate arithmetic average of Sampled Velocities
|
||||
for (int32 i = 0; i < SampledVelocities.Num(); i++)
|
||||
{
|
||||
ApproximatedVelocity += SampledVelocities[i];
|
||||
|
||||
// Draw debug lines
|
||||
if (DrawApproximationDebug)
|
||||
{
|
||||
FVector StartLoc = Hand == EControllerHand::Left ? LeftHandMesh->GetComponentLocation() : RightHandMesh->GetComponentLocation();
|
||||
DrawDebugLine(GetWorld(), StartLoc, StartLoc + SampledVelocities[i], FColor::Magenta, false, 2.f);
|
||||
}
|
||||
}
|
||||
ApproximatedVelocity = ApproximatedVelocity / SampledVelocities.Num();
|
||||
}
|
||||
|
||||
// Draw final result debug
|
||||
if (DrawApproximationDebug)
|
||||
{
|
||||
FVector StartLoc = Hand == EControllerHand::Left ? LeftHandMesh->GetComponentLocation() : RightHandMesh->GetComponentLocation();
|
||||
DrawDebugLine(GetWorld(), StartLoc, StartLoc + ApproximatedVelocity, FColor::Green, false, 2.f);
|
||||
}
|
||||
|
||||
return ApproximatedVelocity;
|
||||
}
|
||||
|
||||
// Throw object
|
||||
void AFireworksPawn::ThrowObject(APickableObject* Object, EControllerHand Hand)
|
||||
{
|
||||
Object->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
|
||||
Object->StaticMesh->SetSimulatePhysics(true);
|
||||
Object->StaticMesh->SetPhysicsLinearVelocity(ApproximateThrowVelocity(Hand) * ThrowVelocityMultiplier);
|
||||
Object->ThrowEffects();
|
||||
}
|
||||
|
||||
// Drop
|
||||
bool AFireworksPawn::Drop(EControllerHand Hand)
|
||||
{
|
||||
if (Hand == EControllerHand::Left) {
|
||||
// Left hand
|
||||
if (IsValid(HeldObject_L)) {
|
||||
ThrowObject(HeldObject_L, Hand);
|
||||
|
||||
HeldObject_L = nullptr;
|
||||
IsGrabbingL = false;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Right hand
|
||||
if (IsValid(HeldObject_R)) {
|
||||
ThrowObject(HeldObject_R, Hand);
|
||||
|
||||
HeldObject_R = nullptr;
|
||||
IsGrabbingR = false;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
void AFireworksPawn::EnableLaserOnHand(EControllerHand Hand)
|
||||
{
|
||||
if (Hand == EControllerHand::Left)
|
||||
{
|
||||
TryShowLaserL = true;
|
||||
}
|
||||
else {
|
||||
TryShowLaserR = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable laser on hand
|
||||
void AFireworksPawn::DisableLaserOnHand(EControllerHand Hand)
|
||||
{
|
||||
if (Hand == EControllerHand::Left)
|
||||
{
|
||||
TryShowLaserL = false;
|
||||
}
|
||||
else {
|
||||
TryShowLaserR = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Update laser visuals and trace
|
||||
void AFireworksPawn::TryUpdateLasers()
|
||||
{
|
||||
// --- Left Hand ---
|
||||
|
||||
// Check if this hand is grabbing anything, if not - continue
|
||||
if (!IsGrabbingL) {
|
||||
|
||||
// Check if is pointing at any widget - if yes, omit trace and show laser
|
||||
if (WidgetInteractionL->IsOverHitTestVisibleWidget()) {
|
||||
LaserL->SetHiddenInGame(false);
|
||||
LaserL->SetRelativeScale3D(FVector(WidgetInteractionL->GetLastHitResult().Distance, LaserL->GetRelativeScale3D().Y, LaserL->GetRelativeScale3D().Z));
|
||||
} // If not pointing widget, check if Laser (teleport) button is pressed - if yes, show laser
|
||||
else if (TryShowLaserL)
|
||||
{
|
||||
FVector StartLocation = LaserL->GetComponentLocation();
|
||||
FVector EndLocation = StartLocation + (WidgetInteractionL->GetForwardVector() * WidgetInteractionL->InteractionDistance);
|
||||
GetWorld()->LineTraceSingleByChannel(CurrentLaserHitL, StartLocation, EndLocation, ECollisionChannel::ECC_Visibility);
|
||||
|
||||
LaserL->SetHiddenInGame(false);
|
||||
LaserL->SetRelativeScale3D(FVector(CurrentLaserHitL.Distance, LaserL->GetRelativeScale3D().Y, LaserL->GetRelativeScale3D().Z));
|
||||
} // If the laser is visible, and should not - hide it
|
||||
else if(!LaserL->bHiddenInGame)
|
||||
{
|
||||
LaserL->SetHiddenInGame(true);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Right Hand ---
|
||||
|
||||
// Check if this hand is grabbing anything, if not - continue
|
||||
if (!IsGrabbingR) {
|
||||
|
||||
// Check if is pointing at any widget - if yes, omit trace and show laser
|
||||
if (WidgetInteractionR->IsOverHitTestVisibleWidget()) {
|
||||
LaserR->SetHiddenInGame(false);
|
||||
LaserR->SetRelativeScale3D(FVector(WidgetInteractionR->GetLastHitResult().Distance, LaserR->GetRelativeScale3D().Y, LaserR->GetRelativeScale3D().Z));
|
||||
} // If not pointing widget, check if Laser (teleport) button is pressed - if yes, show laser
|
||||
else if (TryShowLaserR)
|
||||
{
|
||||
FVector StartLocation = LaserR->GetComponentLocation();
|
||||
FVector EndLocation = StartLocation + (WidgetInteractionR->GetForwardVector() * WidgetInteractionR->InteractionDistance);
|
||||
GetWorld()->LineTraceSingleByChannel(CurrentLaserHitR, StartLocation, EndLocation, ECollisionChannel::ECC_Visibility);
|
||||
|
||||
LaserR->SetHiddenInGame(false);
|
||||
LaserR->SetRelativeScale3D(FVector(CurrentLaserHitR.Distance, LaserR->GetRelativeScale3D().Y, LaserR->GetRelativeScale3D().Z));
|
||||
} // If the laser is visible, and should not - hide it
|
||||
else if (!LaserR->bHiddenInGame)
|
||||
{
|
||||
LaserR->SetHiddenInGame(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try update teleport visual
|
||||
void AFireworksPawn::TryUpdateTeleportVisual()
|
||||
{
|
||||
bool RightLaserCanTeleport = !LaserR->bHiddenInGame && (IsValid(CurrentLaserHitR.GetActor()) ? CurrentLaserHitR.GetActor()->ActorHasTag(TEXT("Ground")) : false);
|
||||
bool LeftLaserCanTeleport = !LaserL->bHiddenInGame && (IsValid(CurrentLaserHitL.GetActor()) ? CurrentLaserHitL.GetActor()->ActorHasTag(TEXT("Ground")) : false);
|
||||
|
||||
// Firstly cover the case of both hands pointing at ground with laser
|
||||
if (RightLaserCanTeleport && LeftLaserCanTeleport)
|
||||
{
|
||||
if (DominatingHand == EControllerHand::Left)
|
||||
{
|
||||
TeleportVisual->SetActorHiddenInGame(false);
|
||||
TeleportVisual->SetActorLocation(CurrentLaserHitL.Location);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
TeleportVisual->SetActorHiddenInGame(false);
|
||||
TeleportVisual->SetActorLocation(CurrentLaserHitR.Location);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any hand is pointing laser at the ground
|
||||
if (LeftLaserCanTeleport)
|
||||
{
|
||||
TeleportVisual->SetActorHiddenInGame(false);
|
||||
TeleportVisual->SetActorLocation(CurrentLaserHitL.Location);
|
||||
return;
|
||||
}
|
||||
else if (RightLaserCanTeleport)
|
||||
{
|
||||
TeleportVisual->SetActorHiddenInGame(false);
|
||||
TeleportVisual->SetActorLocation(CurrentLaserHitR.Location);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
TeleportVisual->SetActorHiddenInGame(true);
|
||||
}
|
||||
}
|
||||
182
Source/FireworkDuels/FireworksPawn.h
Normal file
182
Source/FireworkDuels/FireworksPawn.h
Normal file
@@ -0,0 +1,182 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Components/SceneComponent.h"
|
||||
#include "PickableObject.h"
|
||||
#include "MotionControllerComponent.h"
|
||||
#include "Components/SphereComponent.h"
|
||||
#include "Components/SkeletalMeshComponent.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "WickComponent.h"
|
||||
#include "Components/WidgetInteractionComponent.h"
|
||||
#include "DrawDebugHelpers.h"
|
||||
#include "CustomDataTypes.h"
|
||||
#include "FireworksPawn.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AFireworksPawn : public APawn
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this pawn's properties
|
||||
AFireworksPawn();
|
||||
|
||||
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;
|
||||
|
||||
// Components
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
USceneComponent* PawnRoot;
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
USceneComponent* CameraRoot;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
UCameraComponent* VRCamera;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
UMotionControllerComponent* MotionControllerR;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
UMotionControllerComponent* MotionControllerL;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
USkeletalMeshComponent* LeftHandMesh;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
USkeletalMeshComponent* RightHandMesh;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
USphereComponent* RightHandCollision;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
USphereComponent* LeftHandCollision;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
UStaticMeshComponent* LaserL;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
UStaticMeshComponent* LaserR;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UWidgetInteractionComponent* WidgetInteractionL;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UWidgetInteractionComponent* WidgetInteractionR;
|
||||
|
||||
// Variables
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FInventory Inventory;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
APickableObject* HeldObject_R;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
APickableObject* HeldObject_L;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 Cash;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
APickableObject* HoveredActorR;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
APickableObject* HoveredActorL;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool IsGrabbingR;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool IsGrabbingL;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool TryShowLaserR;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool TryShowLaserL;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool DrawApproximationDebug = false;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throwing")
|
||||
float ThrowVelocityMultiplier = 1.f;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
FHitResult CurrentLaserHitL;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
FHitResult CurrentLaserHitR;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
AActor* TeleportVisual;
|
||||
|
||||
// How much velocity samples should be recorded for throwing direction approximation
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Throwing")
|
||||
int32 VelocitySamples = 5;
|
||||
|
||||
TArray<FVector> VelocitySamples_L;
|
||||
TArray<FVector> VelocitySamples_R;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
EControllerHand DominatingHand = EControllerHand::Right;
|
||||
|
||||
// Functions
|
||||
|
||||
// Try to grab object
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool TryGrab(EControllerHand Hand);
|
||||
|
||||
// Drop object
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool Drop(EControllerHand Hand);
|
||||
|
||||
// Attach grabbed object to the hand at specified socket transform
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetupGrabAttachment(EControllerHand Hand);
|
||||
|
||||
// Throw an object
|
||||
void ThrowObject(APickableObject* Object, EControllerHand Hand);
|
||||
|
||||
// Sample hand velocities
|
||||
void SampleHandVelocities();
|
||||
|
||||
// Approximate throw velocity
|
||||
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
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void EnableLaserOnHand(EControllerHand Hand);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DisableLaserOnHand(EControllerHand Hand);
|
||||
|
||||
UFUNCTION()
|
||||
void TryUpdateLasers();
|
||||
|
||||
UFUNCTION()
|
||||
void TryUpdateTeleportVisual();
|
||||
};
|
||||
44
Source/FireworkDuels/InventoryCrate.cpp
Normal file
44
Source/FireworkDuels/InventoryCrate.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
// All rights reserved.
|
||||
|
||||
|
||||
#include "InventoryCrate.h"
|
||||
|
||||
// Sets default values
|
||||
AInventoryCrate::AInventoryCrate()
|
||||
{
|
||||
// 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;
|
||||
|
||||
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
|
||||
ItemMesh1 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ItemMesh1"));
|
||||
ItemMesh1->SetupAttachment(StaticMesh);
|
||||
ItemMesh2 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ItemMesh2"));
|
||||
ItemMesh2->SetupAttachment(StaticMesh);
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AInventoryCrate::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AInventoryCrate::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
FloatItemMeshes(DeltaTime);
|
||||
}
|
||||
|
||||
void AInventoryCrate::FloatItemMeshes(float DeltaTime)
|
||||
{
|
||||
if (Show1)
|
||||
{
|
||||
ItemMesh1->AddRelativeRotation(FRotator(0.f, 0.f, (30.f * DeltaTime)));
|
||||
}
|
||||
|
||||
if (Show2)
|
||||
{
|
||||
ItemMesh2->AddRelativeRotation(FRotator(0.f, 0.f, (30.f * DeltaTime)));
|
||||
}
|
||||
}
|
||||
53
Source/FireworkDuels/InventoryCrate.h
Normal file
53
Source/FireworkDuels/InventoryCrate.h
Normal file
@@ -0,0 +1,53 @@
|
||||
// All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "CustomDataTypes.h"
|
||||
#include "FireworkBase.h"
|
||||
#include "InventoryCrate.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AInventoryCrate : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AInventoryCrate();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UStaticMeshComponent* StaticMesh;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
UStaticMeshComponent* ItemMesh1;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
UStaticMeshComponent* ItemMesh2;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
bool Show1 = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
bool Show2 = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TEnumAsByte<Firework> Item1;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TEnumAsByte<Firework> Item2;
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
UFUNCTION()
|
||||
void FloatItemMeshes(float DeltaTime);
|
||||
|
||||
};
|
||||
41
Source/FireworkDuels/InventoryItem.cpp
Normal file
41
Source/FireworkDuels/InventoryItem.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "InventoryItem.h"
|
||||
|
||||
// Sets default values
|
||||
AInventoryItem::AInventoryItem()
|
||||
{
|
||||
// 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;
|
||||
|
||||
StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Static Mesh Component"));
|
||||
RootComponent = StaticMeshComponent;
|
||||
StaticMeshComponent->SetCollisionProfileName(TEXT("NoCollision"));
|
||||
Collision = CreateDefaultSubobject<USphereComponent>(TEXT("Collision"));
|
||||
Collision->SetupAttachment(RootComponent);
|
||||
Collision->SetSphereRadius(CollisionRadius);
|
||||
Collision->SetCollisionObjectType(ECollisionChannel::ECC_Vehicle);
|
||||
Collision->SetCollisionProfileName(TEXT("OverpalAll"));
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AInventoryItem::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AInventoryItem::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
|
||||
// Initailize
|
||||
void AInventoryItem::Initialize()
|
||||
{
|
||||
StaticMeshComponent->SetStaticMesh(StaticMesh);
|
||||
|
||||
}
|
||||
56
Source/FireworkDuels/InventoryItem.h
Normal file
56
Source/FireworkDuels/InventoryItem.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/SphereComponent.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "CustomDataTypes.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "InventoryItem.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AInventoryItem : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AInventoryItem();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
UStaticMeshComponent* StaticMeshComponent;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
USphereComponent* Collision;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UStaticMesh* StaticMesh;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
FFireworkEntry FireworkEntryData;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||
float TargetDistanceAlongSpline;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
bool bIsFirework;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float CollisionRadius;
|
||||
|
||||
UFUNCTION()
|
||||
void Initialize();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void TryDestroy();
|
||||
|
||||
};
|
||||
71
Source/FireworkDuels/InventoryManager.cpp
Normal file
71
Source/FireworkDuels/InventoryManager.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#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;
|
||||
}
|
||||
32
Source/FireworkDuels/InventoryManager.h
Normal file
32
Source/FireworkDuels/InventoryManager.h
Normal file
@@ -0,0 +1,32 @@
|
||||
// All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "CustomDataTypes.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "InventoryManager.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AInventoryManager : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
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();
|
||||
|
||||
};
|
||||
5
Source/FireworkDuels/MySplineMeshComponent.cpp
Normal file
5
Source/FireworkDuels/MySplineMeshComponent.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "MySplineMeshComponent.h"
|
||||
|
||||
17
Source/FireworkDuels/MySplineMeshComponent.h
Normal file
17
Source/FireworkDuels/MySplineMeshComponent.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/SplineMeshComponent.h"
|
||||
#include "MySplineMeshComponent.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API UMySplineMeshComponent : public USplineMeshComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
30
Source/FireworkDuels/PickableObject.cpp
Normal file
30
Source/FireworkDuels/PickableObject.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "PickableObject.h"
|
||||
|
||||
// Sets default values
|
||||
APickableObject::APickableObject()
|
||||
{
|
||||
// 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;
|
||||
|
||||
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
|
||||
StaticMesh->SetStaticMesh(Mesh);
|
||||
RootComponent = StaticMesh;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void APickableObject::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void APickableObject::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
55
Source/FireworkDuels/PickableObject.h
Normal file
55
Source/FireworkDuels/PickableObject.h
Normal file
@@ -0,0 +1,55 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "Engine/StaticMesh.h"
|
||||
#include "Animation/AnimSequenceBase.h"
|
||||
#include "PickableObject.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API APickableObject : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
APickableObject();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
|
||||
UStaticMesh* Mesh;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
UStaticMeshComponent* StaticMesh;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
bool CanBeGrabbed;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
UAnimSequenceBase* GrabAnimMod;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
|
||||
FTransform InventoryAdditionalTransform;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool IsHeld;
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
|
||||
void OnUsed();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
|
||||
void OnEndUsed();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void ThrowEffects();
|
||||
};
|
||||
4
Source/FireworkDuels/Private/FKGameState.cpp
Normal file
4
Source/FireworkDuels/Private/FKGameState.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
// All rights reserved.
|
||||
|
||||
|
||||
#include "FKGameState.h"
|
||||
17
Source/FireworkDuels/Public/FKGameState.h
Normal file
17
Source/FireworkDuels/Public/FKGameState.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameStateBase.h"
|
||||
#include "../InventoryManager.h"
|
||||
#include "FKGameState.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AFKGameState : public AGameStateBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
26
Source/FireworkDuels/SpawnManager.cpp
Normal file
26
Source/FireworkDuels/SpawnManager.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// All rights reserved.
|
||||
|
||||
|
||||
#include "SpawnManager.h"
|
||||
|
||||
// Sets default values
|
||||
ASpawnManager::ASpawnManager()
|
||||
{
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
void ASpawnManager::GenerateBoard() {
|
||||
int32 ClassesCount = SpawnableClasses.Num();
|
||||
FVector ActorLocation = this->GetActorLocation();
|
||||
|
||||
for (int32 i = 0; i < BlocksY; i++) {
|
||||
for (int32 o = 0; o < BlocksX; o++) {
|
||||
int32 RandomIndex = FMath::RandRange(0, ClassesCount - 1);
|
||||
FTransform SpawnTransform;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Source/FireworkDuels/SpawnManager.h
Normal file
39
Source/FireworkDuels/SpawnManager.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "BuildingBlock.h"
|
||||
#include "Math/UnrealMathUtility.h"
|
||||
#include "SpawnManager.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API ASpawnManager : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
ASpawnManager();
|
||||
|
||||
protected:
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float Distance = 45.0f;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
int32 BlocksX = 5;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
int32 BlocksY = 5;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<TSubclassOf<ABuildingBlock>> SpawnableClasses;
|
||||
|
||||
UFUNCTION(BlueprintCallable, CallInEditor)
|
||||
void GenerateBoard();
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
35
Source/FireworkDuels/WickComponent.cpp
Normal file
35
Source/FireworkDuels/WickComponent.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "WickComponent.h"
|
||||
|
||||
// Called when the game starts
|
||||
void UWickComponent::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
if (IsValid(GetStaticMesh().Get()))
|
||||
{
|
||||
DynamicMaterialReference = UMaterialInstanceDynamic::Create(GetStaticMesh().Get()->GetMaterial(0), this);
|
||||
SetMaterial(0, DynamicMaterialReference);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTransform UWickComponent::UpdateWickBurnEffects(float Alpha)
|
||||
{
|
||||
FTransform CurrentTransform = CalcSliceTransformAtSplineOffset(1.f - Alpha);
|
||||
|
||||
if (IsValid(EmitterReference))
|
||||
{
|
||||
EmitterReference->SetWorldLocation(UKismetMathLibrary::TransformLocation(GetComponentTransform(), CurrentTransform.GetLocation()));
|
||||
}
|
||||
|
||||
if (IsValid(DynamicMaterialReference))
|
||||
{
|
||||
DynamicMaterialReference->SetScalarParameterValue(TEXT("Alpha"), Alpha);
|
||||
DynamicMaterialReference->SetVectorParameterValue(TEXT("BurnLocation"), UKismetMathLibrary::TransformLocation(GetComponentTransform(), CurrentTransform.GetLocation()));
|
||||
}
|
||||
|
||||
return CurrentTransform;
|
||||
}
|
||||
32
Source/FireworkDuels/WickComponent.h
Normal file
32
Source/FireworkDuels/WickComponent.h
Normal file
@@ -0,0 +1,32 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/SplineMeshComponent.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "NiagaraComponent.h"
|
||||
#include "Materials/MaterialInstanceDynamic.h"
|
||||
#include "WickComponent.generated.h"
|
||||
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API UWickComponent : public USplineMeshComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
UPROPERTY()
|
||||
UNiagaraComponent* EmitterReference;
|
||||
|
||||
UPROPERTY()
|
||||
UMaterialInstanceDynamic* DynamicMaterialReference;
|
||||
|
||||
// This function calculates new position of where the wick is currently burning.
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FTransform UpdateWickBurnEffects(float Alpha);
|
||||
};
|
||||
42
Source/FireworkDuels/WristMenuActor.cpp
Normal file
42
Source/FireworkDuels/WristMenuActor.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "WristMenuActor.h"
|
||||
|
||||
// Sets default values
|
||||
AWristMenuActor::AWristMenuActor()
|
||||
{
|
||||
// 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;
|
||||
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
|
||||
Spline = CreateDefaultSubobject<USplineComponent>(TEXT("Spline"));
|
||||
Spline->SetupAttachment(RootComponent);
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AWristMenuActor::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Called every frame
|
||||
void AWristMenuActor::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
}
|
||||
|
||||
// Invoke inventory menu
|
||||
void AWristMenuActor::InvokeInventoryMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AWristMenuActor::RevokeInventoryMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AWristMenuActor::UpdateInventory(FInventory NewInventory) {
|
||||
|
||||
}
|
||||
52
Source/FireworkDuels/WristMenuActor.h
Normal file
52
Source/FireworkDuels/WristMenuActor.h
Normal file
@@ -0,0 +1,52 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "CustomDataTypes.h"
|
||||
#include "PickableObject.h"
|
||||
#include "InventoryItem.h"
|
||||
#include "FireworksPawn.h"
|
||||
#include "Components/SplineComponent.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Components/SceneComponent.h"
|
||||
#include "WristMenuActor.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FIREWORKDUELS_API AWristMenuActor : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AWristMenuActor();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
// Variables
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
USplineComponent* Spline;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FInventory Inventory;
|
||||
|
||||
// Methods
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void InvokeInventoryMenu();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RevokeInventoryMenu();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void UpdateInventory(FInventory NewInventory);
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user