Select randomly the tile to add to the path
This commit is contained in:
parent
9526c2a754
commit
20063b408c
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4702776094ca194fc90b39435008fab198657e64f32856c9877692905f37138d
|
||||
oid sha256:f2428ad929b6fc4932acf4371f258f1fe703478b3cf4cf42f36332d751a4b2d7
|
||||
size 36794
|
||||
|
||||
@ -36,7 +36,9 @@ void APathGenerator::AddFloorTile()
|
||||
{
|
||||
if (Tiles[0] != nullptr)
|
||||
{
|
||||
ATile* GeneratedTile = GetWorld()->SpawnActor<ATile>(Tiles[0], tNextSpawnPoint);
|
||||
|
||||
int iRandomIndex = FMath::RandRange(0, Tiles.Num() - 1);
|
||||
ATile* GeneratedTile = GetWorld()->SpawnActor<ATile>(Tiles[iRandomIndex], tNextSpawnPoint);
|
||||
tNextSpawnPoint = GeneratedTile->GetAttachTransform();
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,13 +32,11 @@ void ATileCurve::TurnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AAct
|
||||
{
|
||||
if (bTurnRight && !bTurnLeft)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("[ATileCurve::OnBeginOverlapChild] Rotating right"));
|
||||
ZombieCharacter->bStraight = false;
|
||||
ZombieCharacter->iSideTurn = 1;
|
||||
}
|
||||
else if (!bTurnRight && bTurnLeft)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("[ATileCurve::OnBeginOverlapChild] Rotating left"));
|
||||
ZombieCharacter->bStraight = false;
|
||||
ZombieCharacter->iSideTurn = -1;
|
||||
}
|
||||
|
||||
@ -195,7 +195,6 @@ void AZombieCharacter::ControlTurning()
|
||||
{
|
||||
fTimelineValue = TurnTimeline.GetPlaybackPosition();
|
||||
float fTurnCurve = TurnCurve->GetFloatValue(fTimelineValue);
|
||||
UE_LOG(LogTemp, Warning, TEXT("[AZombieCharacter::ControlTurning] TurnCurve: %f"), fTurnCurve);
|
||||
|
||||
float fVal = fTurnCurve - fPrevCurvValue;
|
||||
fPrevCurvValue = fTurnCurve;
|
||||
@ -207,8 +206,6 @@ void AZombieCharacter::ControlTurning()
|
||||
FRotator CurrentRotation = Controller->GetControlRotation();
|
||||
CurrentRotation.Yaw += fVal * iSideTurn;
|
||||
Controller->SetControlRotation(CurrentRotation);
|
||||
UE_LOG(LogTemp, Warning, TEXT("[AZombieCharacter::ControlTurning] Yaw: %f"), CurrentRotation.Yaw);
|
||||
UE_LOG(LogTemp, Warning, TEXT("[AZombieCharacter::ControlTurning] Control Turn: %f"), fControlTurn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user