Created the turn left tile and modified the collision
This commit is contained in:
parent
24edf34abf
commit
9526c2a754
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:37e7daf1431d2c994ad4027c7f1a025693551f04212539b979a231e00c4f5925
|
||||
size 22666
|
||||
oid sha256:ef7d569bc00343bf21433a9cfd84c174063e963a6b5ea0e7c07f2ac11bfcfd8f
|
||||
size 22827
|
||||
|
||||
3
Content/Blueprints/Tiles/BP_TileTurnLeft.uasset
Normal file
3
Content/Blueprints/Tiles/BP_TileTurnLeft.uasset
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4908692256a8bd59e7a12cfecd3986e5e29047fbc1e08e067a7a2aa949f72efe
|
||||
size 36617
|
||||
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:128870a6a999e250ae12fe9bf93bd5b80915245a672072c449950e09e49c5de4
|
||||
size 32357
|
||||
oid sha256:4702776094ca194fc90b39435008fab198657e64f32856c9877692905f37138d
|
||||
size 36794
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b4e620fed07f31f7c8b4d0fb8dd2ed2573c0eeb3fafe04db388fee2392bf4cad
|
||||
size 19728
|
||||
oid sha256:60905fe7b9218b65432b582878be699759c98b01a47d4cbc5588b1907328e32d
|
||||
size 20422
|
||||
|
||||
@ -21,6 +21,7 @@ void APathGenerator::BeginPlay()
|
||||
AddSelectedTile(Tiles[0]);
|
||||
}
|
||||
AddSelectedTile(Tiles[1]);
|
||||
AddSelectedTile(Tiles[2]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -30,22 +30,17 @@ void ATileCurve::TurnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AAct
|
||||
{
|
||||
if (!bWasTriggered)
|
||||
{
|
||||
// Yaw
|
||||
float fYawValue;
|
||||
|
||||
if (bTurnRight && !bTurnLeft)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("[ATileCurve::OnBeginOverlapChild] Rotating right"));
|
||||
fYawValue = 90.f;
|
||||
FRotator NewRotation = FRotator(0.f, fYawValue, 0.f);
|
||||
ZombieCharacter->bStraight = false;
|
||||
ZombieCharacter->NewRotation = NewRotation;
|
||||
//ZombieCharacter->RotateCharacter(NewRotation);
|
||||
ZombieCharacter->iSideTurn = 1;
|
||||
}
|
||||
else if (!bTurnRight && bTurnLeft)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("[ATileCurve::OnBeginOverlapChild] Rotating left"));
|
||||
fYawValue = -90.f;
|
||||
ZombieCharacter->bStraight = false;
|
||||
ZombieCharacter->iSideTurn = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -99,9 +99,6 @@ void AZombieCharacter::Tick(float DeltaTime)
|
||||
{
|
||||
MoveForwardConstant(DeltaTime);
|
||||
}
|
||||
|
||||
//NewRotation.Yaw += 5.f;
|
||||
//RotateCharacter(a);
|
||||
}
|
||||
|
||||
// Called to bind functionality to input
|
||||
@ -187,27 +184,11 @@ void AZombieCharacter::PlayTurn()
|
||||
}
|
||||
}
|
||||
|
||||
void AZombieCharacter::UpdateDirection(int i)
|
||||
{
|
||||
iCurrentDirection += i;
|
||||
if (iCurrentDirection > mDirections.Num())
|
||||
{
|
||||
iCurrentDirection = 0;
|
||||
}
|
||||
else if (iCurrentDirection < 0)
|
||||
{
|
||||
iCurrentDirection = mDirections.Num();
|
||||
}
|
||||
|
||||
vCurrentDirection = mDirections[iCurrentDirection];
|
||||
}
|
||||
|
||||
void AZombieCharacter::RotateCharacter()
|
||||
{
|
||||
FRotator CurrentRotation = GetActorRotation();
|
||||
fControlTurn = 0.f;
|
||||
PlayTurn();
|
||||
UE_LOG(LogTemp, Warning, TEXT("Girao"));
|
||||
//Controller->SetControlRotation(NewRotation + CurrentRotation);
|
||||
}
|
||||
|
||||
void AZombieCharacter::ControlTurning()
|
||||
@ -224,11 +205,10 @@ void AZombieCharacter::ControlTurning()
|
||||
if (fControlTurn <= 90.f)
|
||||
{
|
||||
FRotator CurrentRotation = Controller->GetControlRotation();
|
||||
CurrentRotation.Yaw += fVal;
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -238,5 +218,5 @@ void AZombieCharacter::SetState()
|
||||
bReadyState = true;
|
||||
bTurning = false;
|
||||
bStraight = true;
|
||||
UE_LOG(LogTemp, Warning, TEXT("[AZombieCharacter::SetState] Set state"));
|
||||
fPrevCurvValue = 0.f;
|
||||
}
|
||||
@ -66,7 +66,7 @@ public:
|
||||
|
||||
void RotateCharacter();
|
||||
bool bStraight = true;
|
||||
FRotator NewRotation = FRotator(0.f, 0.f, 0.f);
|
||||
int iSideTurn = 1;
|
||||
|
||||
// Properties for the timeline to turn right
|
||||
UFUNCTION()
|
||||
@ -87,8 +87,6 @@ public:
|
||||
int iCurrentDirection = 0;
|
||||
FVector vCurrentDirection;
|
||||
|
||||
void UpdateDirection(int i);
|
||||
|
||||
private:
|
||||
|
||||
void MoveForwardConstant(float DeltaTime);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user