Section 5 - The Weapon - Course 60

Finishing the Pickup Widget
This commit is contained in:
charnet3d 2022-06-12 08:34:57 +01:00
parent db99dfd413
commit 402ede1696
17 changed files with 136 additions and 3 deletions

BIN
Content/_Game/Assets/Fonts/pirulen_rg.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/Assets/Fonts/pirulen_rg_Font.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/Assets/Fonts/rexlia_rg.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/Assets/Fonts/rexlia_rg_Font.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
Content/_Game/Assets/Textures/Icons/SmallAmmo.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/Assets/Textures/Icons/StarIcon.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/HUD/PickupWidgetBP.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/Maps/Factory.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/_Game/Materials/BelicaMaterials/Transparent.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/_Game/Weapons/Meshes/Belica_Guns.uasset (Stored with Git LFS) Normal file

Binary file not shown.

33
Source/Shooter/Item.cpp Normal file
View File

@ -0,0 +1,33 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Item.h"
#include "Components/BoxComponent.h"
// Sets default values
AItem::AItem()
{
// 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;
ItemMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("ItemMesh"));
SetRootComponent(ItemMesh);
CollisionBox = CreateDefaultSubobject<UBoxComponent>(TEXT("CollisionBox"));
CollisionBox->SetupAttachment(ItemMesh);
}
// Called when the game starts or when spawned
void AItem::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AItem::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

45
Source/Shooter/Item.h Normal file
View File

@ -0,0 +1,45 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Item.generated.h"
class UBoxComponent;
class UWidgetComponent;
UCLASS()
class SHOOTER_API AItem : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AItem();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
private:
/* Skeletal mesh for the item */
UPROPERTY(VisibleAnywhere, BlueprintReadonly, Category = "Item Properties", meta = (AllowPrivateAccess = true))
USkeletalMeshComponent* ItemMesh;
/* Line trace collides with box to show HUD widgets */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true))
UBoxComponent* CollisionBox;
/* Popup widget for when the player looks at the item */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true))
UWidgetComponent* PickupWidget;
public:
};

View File

@ -8,7 +8,7 @@ public class Shooter : ModuleRules
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
PrivateDependencyModuleNames.AddRange(new string[] { });

View File

@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Weapon.h"

17
Source/Shooter/Weapon.h Normal file
View File

@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Item.h"
#include "Weapon.generated.h"
/**
*
*/
UCLASS()
class SHOOTER_API AWeapon : public AItem
{
GENERATED_BODY()
};