Updated Combat to Set Camera to Face Enemy
This commit is contained in:
parent
b5048e4be3
commit
d100a85a0d
BIN
Content/Assets/Objects/Tutrorial_Assets/Tutorial_Wood_Texture.uasset
(Stored with Git LFS)
BIN
Content/Assets/Objects/Tutrorial_Assets/Tutorial_Wood_Texture.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/C2Plane.uasset
(Stored with Git LFS)
BIN
Content/Levels/C2Plane.uasset
(Stored with Git LFS)
Binary file not shown.
@ -122,7 +122,7 @@ void ATempCharacter::KeyPressed()
|
|||||||
// Line trace logic
|
// Line trace logic
|
||||||
void ATempCharacter::LineTraceLogic()
|
void ATempCharacter::LineTraceLogic()
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Display, TEXT("LineTraceLogic activated"));
|
//UE_LOG(LogTemp, Display, TEXT("LineTraceLogic activated"));
|
||||||
float GlobalTrace = TraceDistance;
|
float GlobalTrace = TraceDistance;
|
||||||
FHitResult OutHit;
|
FHitResult OutHit;
|
||||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||||
|
@ -28,7 +28,6 @@ protected:
|
|||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Sneak();
|
void Sneak();
|
||||||
|
|
||||||
|
|
||||||
UCapsuleComponent* PlayerCapsule;
|
UCapsuleComponent* PlayerCapsule;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -36,7 +36,6 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
|||||||
EnemyBlackboard->SetValueAsBool("IsInCombat", true);
|
EnemyBlackboard->SetValueAsBool("IsInCombat", true);
|
||||||
FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health"));
|
FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health"));
|
||||||
int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr<int32>(Enemy);
|
int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr<int32>(Enemy);
|
||||||
|
|
||||||
EnemyHealth = EnemyHealthPtr;
|
EnemyHealth = EnemyHealthPtr;
|
||||||
|
|
||||||
if (HUD->IsInViewport()) return;
|
if (HUD->IsInViewport()) return;
|
||||||
@ -58,6 +57,14 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
|||||||
PlayerController->SetInputMode(FInputModeUIOnly());
|
PlayerController->SetInputMode(FInputModeUIOnly());
|
||||||
PlayerController->bShowMouseCursor = true;
|
PlayerController->bShowMouseCursor = true;
|
||||||
|
|
||||||
|
FVector Direction = Enemy->GetActorLocation() - PlayerActor->GetActorLocation();
|
||||||
|
Direction.Normalize();
|
||||||
|
FRotator LookAtRotation = FRotationMatrix::MakeFromX(Direction).Rotator();
|
||||||
|
LookAtRotation.Pitch = -9.0f;
|
||||||
|
PlayerController->SetControlRotation(LookAtRotation);
|
||||||
|
|
||||||
|
//DrawDebugPoint(GetWorld(), Enemy->GetActorLocation(), 10, FColor::Red, false, 10);
|
||||||
|
|
||||||
CurrentComboString = "";
|
CurrentComboString = "";
|
||||||
UpdateComboString(CurrentComboString);
|
UpdateComboString(CurrentComboString);
|
||||||
RevertActionPoints();
|
RevertActionPoints();
|
||||||
|
Loading…
Reference in New Issue
Block a user