-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPickup.cpp
More file actions
61 lines (47 loc) · 1.7 KB
/
Pickup.cpp
File metadata and controls
61 lines (47 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Fill out your copyright notice in the Description page of Project Settings.
#include "BatteryCollector.h"
#include "Pickup.h"
// Sets default values
APickup::APickup()
{
// 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;
// All pickups start active
isActive = true;
// Create Static Mesh Component
pickupMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("pickupMesh"));
RootComponent = pickupMesh;
}
// Called when the game starts or when spawned
void APickup::BeginPlay()
{
// Registers with scene and does other "setup" functions
Super::BeginPlay();
}
// ---------------------------------------------------------------------------------------------------------------------
// IsActive
// input
// None
// return
// Boolean describing the state of the pickup
//
// ---------------------------------------------------------------------------------------------------------------------
bool APickup::IsActive(){
return isActive;
}
// ---------------------------------------------------------------------------------------------------------------------
// SetActive
// input
// bool newPickupState - the new state of the pickup
// return
// None
//
// ---------------------------------------------------------------------------------------------------------------------
void APickup::SetActive(bool newPickupState){
isActive = newPickupState;
}
void APickup::CollectPickup_Implementation(){
// Log debug
FString pickupDebugString = GetName();
UE_LOG(LogClass, Log, TEXT("You have collected %s"), *pickupDebugString)
}