Section 5 - The Weapon - Course 60
Finishing the Pickup Widget
This commit is contained in:
parent
71e23f16d3
commit
a42c387205
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.
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
@ -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:
|
||||
|
||||
};
|
|
@ -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[] { });
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Weapon.h"
|
||||
|
|
@ -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()
|
||||
|
||||
};
|
Loading…
Reference in New Issue