-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerSpawnGroup.cpp
75 lines (61 loc) · 1.77 KB
/
PlayerSpawnGroup.cpp
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Fill out your copyright notice in the Description page of Project Settings.
#include "PlayerSpawnGroup.h"
#include "GameFramework/PlayerStart.h"
#include "Components/BillboardComponent.h"
#include "../../Environment/UFO/UFO.h"
#if WITH_EDITOR
#include "DrawDebugHelpers.h"
#endif
// Sets default values
APlayerSpawnGroup::APlayerSpawnGroup()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
#if WITH_EDITOR
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.bStartWithTickEnabled = true;
#else
PrimaryActorTick.bCanEverTick = false;
PrimaryActorTick.bStartWithTickEnabled = false;
#endif
//Disable damage
bCanBeDamaged = false;
//Set root
SetRootComponent(CreateDefaultSubobject<UBillboardComponent>("Root"));
}
bool APlayerSpawnGroup::ShouldTickIfViewportsOnly() const
{
#if WITH_EDITOR
//Draw arrows indicating next nodes
if (SpawnPoints.Num() > 0)
{
UWorld* const World = GetWorld();
if (World)
{
const FVector ActorPos = GetActorLocation();
for (AActor* const Actor : SpawnPoints)
{
if (Actor)
{
//DrawDebugLine(World, ActorPos, Actor->GetActorLocation(), FColor::Blue, false, -1.f, '\000', 4.f);
DrawDebugDirectionalArrow(World, ActorPos, Actor->GetActorLocation(), 1000.f, FColor::Green, false, -1.f, '\000', 4.f);
}
}
if (LinkedUFO)
{
DrawDebugDirectionalArrow(World, ActorPos, LinkedUFO->GetActorLocation(), 1000.f, FColor::Green, false, -1.f, '\000', 4.f);
}
}
}
return true;
#else
return false;
#endif
}
TArray<APlayerStart*> APlayerSpawnGroup::GetSpawnPoints() const
{
return SpawnPoints;
}
AUFO* const APlayerSpawnGroup::GetLinkedUFO() const
{
return LinkedUFO;
}