-
-
Save BrodyHiggerson/da7090aaa886ce72e61f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FlightPrototype.h" | |
#include "ShipStart.h" | |
#include "Ship.h" | |
AShipStart::AShipStart(const class FPostConstructInitializeProperties& PCIP) | |
: Super(PCIP) | |
{ | |
SpawnBoxComponent = PCIP.CreateDefaultSubobject<UBoxComponent>(this, "Spawn Box"); | |
if (SpawnBoxComponent) | |
{ | |
SpawnBoxComponent->SetWorldScale3D(FVector(200, 200, 200)); | |
SpawnBoxComponent->AttachParent = RootComponent; | |
} | |
ArrowComponent->SetWorldScale3D(FVector(100, 100, 100)); | |
bHasSpawnedShip = false; | |
pMostRecentShipSpawn = nullptr; | |
TeamNum = -1; | |
} | |
bool AShipStart::HasSpawnedShip() | |
{ | |
return bHasSpawnedShip; | |
} | |
void AShipStart::SetHasSpawnedShip(bool HasSpawned) | |
{ | |
bHasSpawnedShip = HasSpawned; | |
} | |
bool AShipStart::IsSpawnBoxClear() | |
{ | |
TArray<AActor*> OverlappingActors; | |
GetOverlappingActors(OverlappingActors, AShip::StaticClass()); | |
if (OverlappingActors.Num() > 0) | |
{ | |
return false; | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "GameFramework/PlayerStart.h" | |
#include "SpaceTypes.h" | |
#include "ShipStart.generated.h" | |
/** | |
* | |
*/ | |
UCLASS(Blueprintable, hidecategories = Collision) | |
class FLIGHTPROTOTYPE_API AShipStart : public APlayerStart | |
{ | |
GENERATED_UCLASS_BODY() | |
/* Specifies the owning faction for this ship start. */ | |
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Game) // Not used / hasn't been a problem | |
TEnumAsByte<EFactionName::Type> SpawnFaction; // Same as above | |
/* Specifies the owning team for this ship start. */ | |
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Game) | |
int32 TeamNum; | |
/* Returns whether this ship start has spawned a ship yet. */ | |
bool HasSpawnedShip(); | |
/* Set whether or not this ship has spawned a ship. */ | |
void SetHasSpawnedShip(bool HasSpawned); | |
/* Checks if the spawn box is clear of ships. */ | |
bool IsSpawnBoxClear(); | |
protected: | |
/* Whether this ship start has spawned a ship yet. */ | |
bool bHasSpawnedShip; | |
/* The most recently-spawned ship from this ship start. */ | |
AActor* pMostRecentShipSpawn; | |
UPROPERTY(BlueprintReadOnly, Category = Components) | |
TSubobjectPtr<UBoxComponent> SpawnBoxComponent; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment