Skip to content

Commit fde371b

Browse files
committed
Added 'Pickup' class
1 parent 6bf701e commit fde371b

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

BatteryCollector.uproject

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
{
88
"Name": "BatteryCollector",
99
"Type": "Runtime",
10-
"LoadingPhase": "Default"
10+
"LoadingPhase": "Default",
11+
"AdditionalDependencies": [
12+
"Engine"
13+
]
1114
}
1215
]
1316
}

Source/BatteryCollector/Pickup.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Fill out your copyright notice in the Description page of Project Settings.
2+
3+
#include "BatteryCollector.h"
4+
#include "Pickup.h"
5+
6+
7+
// Sets default values
8+
APickup::APickup()
9+
{
10+
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
11+
PrimaryActorTick.bCanEverTick = false;
12+
13+
// Create the static mesh component
14+
PickupMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("PickupMesh"));
15+
RootComponent = PickupMesh;
16+
}
17+
18+
// Called when the game starts or when spawned
19+
void APickup::BeginPlay()
20+
{
21+
Super::BeginPlay();
22+
23+
}
24+
25+
// Called every frame
26+
void APickup::Tick( float DeltaTime )
27+
{
28+
Super::Tick( DeltaTime );
29+
30+
}
31+

Source/BatteryCollector/Pickup.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Fill out your copyright notice in the Description page of Project Settings.
2+
3+
#pragma once
4+
5+
#include "GameFramework/Actor.h"
6+
#include "Pickup.generated.h"
7+
8+
UCLASS()
9+
class BATTERYCOLLECTOR_API APickup : public AActor
10+
{
11+
GENERATED_BODY()
12+
13+
public:
14+
// Sets default values for this actor's properties
15+
APickup();
16+
17+
// Called when the game starts or when spawned
18+
virtual void BeginPlay() override;
19+
20+
// Called every frame
21+
virtual void Tick( float DeltaSeconds ) override;
22+
23+
/** Return the mesh for the pickup */
24+
FORCEINLINE class UStaticMeshComponent* GetMesh() const { return PickupMesh; }
25+
26+
private:
27+
/** Static mesh to represent the pickup in the level*/
28+
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pickup", meta = (AllowPrivateAccess = "true"))
29+
class UStaticMeshComponent* PickupMesh;
30+
31+
};

0 commit comments

Comments
 (0)