Work in the path generation and added the models for the roads
This commit is contained in:
parent
1bad8e09eb
commit
02723795c3
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:96f7e82c945dfc3cff65055bbb2c536680775ea3efe9f3fd79e5f51899530725
|
oid sha256:428d9ef2344016cdbd889195ca121a99f3eae544a690837d2ef3a1418c0f4725
|
||||||
size 19642
|
size 20641
|
||||||
|
|||||||
3
Content/Blueprints/BP_PathGenerator.uasset
Normal file
3
Content/Blueprints/BP_PathGenerator.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:dc4a19c1ae87566ebbdb231db20b810988e9022fd62025b1932346aed0c81174
|
||||||
|
size 22366
|
||||||
3
Content/Blueprints/Tiles/BP_Tile.uasset
Normal file
3
Content/Blueprints/Tiles/BP_Tile.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:a0ce635ee19dc02c30fa73fe2dee1bcfe605b6e6413bf24b4230502154192ad1
|
||||||
|
size 2400
|
||||||
3
Content/Blueprints/Tiles/BP_TileStraight.uasset
Normal file
3
Content/Blueprints/Tiles/BP_TileStraight.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5b3317be7c9d4042271396c2952f0717b70fcfbf100aa15ff2d131554ae0de06
|
||||||
|
size 30566
|
||||||
3
Content/StaticMeshes/Road/asphalt.uasset
Normal file
3
Content/StaticMeshes/Road/asphalt.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:9bdca1d457f6265a170d43d32fbf626d02388f133300955d886598dae2af2d2f
|
||||||
|
size 7610
|
||||||
3
Content/StaticMeshes/Road/asphalt_ncl1_1.uasset
Normal file
3
Content/StaticMeshes/Road/asphalt_ncl1_1.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2ab65bae67ecad95ca916659ff245eed062c6d6903ab984e315b5fad26bc211a
|
||||||
|
size 11041
|
||||||
3
Content/StaticMeshes/Road/concreteSmooth.uasset
Normal file
3
Content/StaticMeshes/Road/concreteSmooth.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:eac930395c1f093e08d773799c061f18e5d290085cf2ff3abdfd17720b8b2d7e
|
||||||
|
size 8258
|
||||||
3
Content/StaticMeshes/Road/concreteSmooth_ncl1_1.uasset
Normal file
3
Content/StaticMeshes/Road/concreteSmooth_ncl1_1.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d14956114b5db06fe2f34d8718d595f23c2e546462d04afcba3e2d0bb6bc99a0
|
||||||
|
size 12364
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_center.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_center.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:96a6d368a11976c3d0d0b299b7d83318c4268b2efee9d1c773d7cc1282e9c379
|
||||||
|
size 14692
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_corner.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_corner.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b4e620fed07f31f7c8b4d0fb8dd2ed2573c0eeb3fafe04db388fee2392bf4cad
|
||||||
|
size 19728
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_cornerInner.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_cornerInner.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3ba7b6f0e3244cbd1108ffefd5df4fd7ff2bcc10201d8c1fd8a83493d5ef9c10
|
||||||
|
size 18548
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_cornerOuter.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_cornerOuter.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:f9bb1320ab856150b03d45f1fb73c5066d724f6746b76c363bf3261d705ce3ec
|
||||||
|
size 18317
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_damaged.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_damaged.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:76fd2733d412935aa3da6532e642fc1a7c2a5db097449639c84ee2f9a1488e43
|
||||||
|
size 18403
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_pavement.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_pavement.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6881707c1ccd677159f8b7b8aa7b01ce610dcc4e68a3d70321dc0d02b1a315bb
|
||||||
|
size 14929
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_side.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_side.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:f523b5fa6dd23cae06ed835e31b5bdd6aec1143ef710dde216c6fb9ee8861813
|
||||||
|
size 17729
|
||||||
3
Content/StaticMeshes/Road/roadAsphalt_straight.uasset
Normal file
3
Content/StaticMeshes/Road/roadAsphalt_straight.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:46d64a64b6685028f5ab93687fe901f70585fe2bbcd0efc8428ba8ab9ff6abc6
|
||||||
|
size 21266
|
||||||
3
Content/StaticMeshes/Wall/concrete.uasset
Normal file
3
Content/StaticMeshes/Wall/concrete.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:f57fad7e6e6f1a5594f7393ef8067777577ef92cf99b6de474d59c3369fb1800
|
||||||
|
size 8685
|
||||||
3
Content/StaticMeshes/Wall/concrete_ncl1_1.uasset
Normal file
3
Content/StaticMeshes/Wall/concrete_ncl1_1.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:463c8794635a53e2d0affa2ac813ef27423bfc2a0ed24bb39e9ee7c566c0ff64
|
||||||
|
size 13630
|
||||||
3
Content/StaticMeshes/Wall/wall_lines.uasset
Normal file
3
Content/StaticMeshes/Wall/wall_lines.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:7d186be31354901a5a32f2c587d609b6bc3335c61775eac6d826b281ddea9338
|
||||||
|
size 9244
|
||||||
3
Content/StaticMeshes/Wall/wall_lines_ncl1_1.uasset
Normal file
3
Content/StaticMeshes/Wall/wall_lines_ncl1_1.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d57379ba020776971b4b5e4604de7597ded80ff2bb5814f7e5d4602222b084de
|
||||||
|
size 13599
|
||||||
3
Content/StaticMeshes/Wall/wall_typeA.uasset
Normal file
3
Content/StaticMeshes/Wall/wall_typeA.uasset
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:77d71b8e7da2bde181549beabfe6e096f4ac34fa52abdac3d31d6449106d9ff4
|
||||||
|
size 18645
|
||||||
41
Source/EndlessZombie/PathGenerator.cpp
Normal file
41
Source/EndlessZombie/PathGenerator.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// Copyright Jorge Kuijper. All Rights Reserved.
|
||||||
|
|
||||||
|
|
||||||
|
#include "PathGenerator.h"
|
||||||
|
|
||||||
|
// Sets default values
|
||||||
|
APathGenerator::APathGenerator()
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
void APathGenerator::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
AddFloorTile();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
void APathGenerator::Tick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void APathGenerator::AddFloorTile()
|
||||||
|
{
|
||||||
|
if (Tile != nullptr)
|
||||||
|
{
|
||||||
|
ATile* GeneratedTile = GetWorld()->SpawnActor<ATile>(Tile, tNextSpawnPoint);
|
||||||
|
tNextSpawnPoint = GeneratedTile->GetAttachTransform();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
34
Source/EndlessZombie/PathGenerator.h
Normal file
34
Source/EndlessZombie/PathGenerator.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright Jorge Kuijper. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "Tile.h"
|
||||||
|
#include "PathGenerator.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class ENDLESSZOMBIE_API APathGenerator : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this actor's properties
|
||||||
|
APathGenerator();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Called every frame
|
||||||
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Tiles")
|
||||||
|
TSubclassOf<class ATile> Tile;
|
||||||
|
|
||||||
|
UFUNCTION(Category = "Tiles")
|
||||||
|
void AddFloorTile();
|
||||||
|
|
||||||
|
FTransform tNextSpawnPoint = FTransform(FVector(90.0f, 1110.0f, 0.0f));
|
||||||
|
};
|
||||||
78
Source/EndlessZombie/Tile.cpp
Normal file
78
Source/EndlessZombie/Tile.cpp
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// Copyright Jorge Kuijper. All Rights Reserved.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Tile.h"
|
||||||
|
#include "ZombieCharacter.h"
|
||||||
|
#include "PathGenerator.h"
|
||||||
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
#include "Kismet/KismetSystemLibrary.h"
|
||||||
|
|
||||||
|
// Sets default values
|
||||||
|
ATile::ATile()
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
// Add scene component
|
||||||
|
SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Scene"));
|
||||||
|
SceneComponent->SetupAttachment(RootComponent);
|
||||||
|
// Add arrow component like attach point
|
||||||
|
ArrowComponent = CreateDefaultSubobject<UArrowComponent>(TEXT("AttachPoint"));
|
||||||
|
ArrowComponent->SetupAttachment(SceneComponent);
|
||||||
|
|
||||||
|
// Add box collider
|
||||||
|
EndTrigger = CreateDefaultSubobject<UBoxComponent>(TEXT("EndPoint"));
|
||||||
|
EndTrigger->SetupAttachment(SceneComponent);
|
||||||
|
EndTrigger->SetCollisionProfileName(TEXT("OverlapOnlyPawn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
void ATile::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
EndTrigger->OnComponentBeginOverlap.AddDynamic(this, &ATile::OnBeginOverlap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
void ATile::Tick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FTransform ATile::GetAttachTransform()
|
||||||
|
{
|
||||||
|
FTransform tAttachPoint;
|
||||||
|
|
||||||
|
tAttachPoint = ArrowComponent->GetComponentTransform();
|
||||||
|
|
||||||
|
return tAttachPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATile::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
|
||||||
|
{
|
||||||
|
AZombieCharacter* ZombieCharacter = Cast<AZombieCharacter>(OtherActor);
|
||||||
|
|
||||||
|
if (ZombieCharacter != nullptr)
|
||||||
|
{
|
||||||
|
TArray<AActor*> ActorsToFind;
|
||||||
|
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APathGenerator::StaticClass(), ActorsToFind);
|
||||||
|
if (ActorsToFind.Num() > 0)
|
||||||
|
{
|
||||||
|
APathGenerator* FoundPathGenerator = Cast<APathGenerator>(ActorsToFind[0]);
|
||||||
|
FoundPathGenerator->AddFloorTile();
|
||||||
|
|
||||||
|
FTimerHandle TimerHandle;
|
||||||
|
|
||||||
|
//GetWorldTimerManager().SetTimer(TimerHandle, this, &ATimeKollapsed_PlayerController::AddWidgetToViewPort, GameOverDelay, false);
|
||||||
|
GetWorldTimerManager().SetTimer(TimerHandle, this, &ATile::test, 2.f, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATile::DestroyTile()
|
||||||
|
{
|
||||||
|
this->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
42
Source/EndlessZombie/Tile.h
Normal file
42
Source/EndlessZombie/Tile.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright Jorge Kuijper. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "Components/ArrowComponent.h"
|
||||||
|
#include "Components/BoxComponent.h"
|
||||||
|
#include "Tile.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class ENDLESSZOMBIE_API ATile : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this actor's properties
|
||||||
|
ATile();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Called every frame
|
||||||
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
USceneComponent* SceneComponent;
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
UArrowComponent* ArrowComponent;
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
UBoxComponent* EndTrigger;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "AttachedPoint")
|
||||||
|
FTransform GetAttachTransform();
|
||||||
|
UFUNCTION()
|
||||||
|
virtual void OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void DestroyTile();
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user