Changes / gameloop almost ready
This commit is contained in:
@@ -14,9 +14,9 @@ ABuildingBlock::ABuildingBlock()
|
||||
}
|
||||
|
||||
void ABuildingBlock::DepleteHealth(float Amount) {
|
||||
Health =- Amount;
|
||||
|
||||
if (Health <= 0.f) {
|
||||
Health = Health - Amount;
|
||||
if (Health <= 0.0f) {
|
||||
UE_LOG(LogTemp, Warning, TEXT("Health below 0 - DestroyingBlock"));
|
||||
DestroyBlock();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -15,11 +15,11 @@ public:
|
||||
// Sets default values for this actor's properties
|
||||
ABuildingBlock();
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
UStaticMeshComponent* StaticMesh;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float Health = 100;
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
float Health = 100.0f;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
float InitialHealth;
|
||||
|
||||
@@ -268,19 +268,18 @@ void AFireworksPawn::DisableLaserOnHand(EControllerHand Hand)
|
||||
if (Hand == EControllerHand::Left)
|
||||
{
|
||||
TryShowLaserL = false;
|
||||
LaserL->SetHiddenInGame(true);
|
||||
}
|
||||
else {
|
||||
TryShowLaserR = false;
|
||||
LaserR->SetHiddenInGame(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Update laser visuals and trace
|
||||
void AFireworksPawn::TryUpdateLasers()
|
||||
{
|
||||
// --- Left Hand ---
|
||||
|
||||
// Check if this hand is grabbing anything, if not - continue
|
||||
if (!IsGrabbingL) {
|
||||
// --- Left Hand ---
|
||||
if (TryShowLaserL)
|
||||
{
|
||||
FVector StartLocation = LaserL->GetComponentLocation();
|
||||
@@ -288,17 +287,9 @@ void AFireworksPawn::TryUpdateLasers()
|
||||
GetWorld()->LineTraceSingleByChannel(CurrentLaserHitL, StartLocation, EndLocation, ECollisionChannel::ECC_Visibility);
|
||||
LaserL->SetHiddenInGame(false);
|
||||
LaserL->SetRelativeScale3D(FVector((CurrentLaserHitL.Distance >= 5.0f ? CurrentLaserHitL.Distance : 1000.0f), LaserL->GetRelativeScale3D().Y, LaserL->GetRelativeScale3D().Z));
|
||||
} // If the laser is visible, and should not - hide it
|
||||
else if(!LaserL->bHiddenInGame)
|
||||
{
|
||||
LaserL->SetHiddenInGame(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Right Hand ---
|
||||
|
||||
// Check if this hand is grabbing anything, if not - continue
|
||||
if (!IsGrabbingR) {
|
||||
if (TryShowLaserR)
|
||||
{
|
||||
FVector StartLocation = LaserR->GetComponentLocation();
|
||||
@@ -306,10 +297,5 @@ void AFireworksPawn::TryUpdateLasers()
|
||||
GetWorld()->LineTraceSingleByChannel(CurrentLaserHitR, StartLocation, EndLocation, ECollisionChannel::ECC_Visibility);
|
||||
LaserR->SetHiddenInGame(false);
|
||||
LaserR->SetRelativeScale3D(FVector((CurrentLaserHitR.Distance >= 5.0f ? CurrentLaserHitR.Distance : 1000.0f), LaserR->GetRelativeScale3D().Y, LaserR->GetRelativeScale3D().Z));
|
||||
} // If the laser is visible, and should not - hide it
|
||||
else if (!LaserR->bHiddenInGame)
|
||||
{
|
||||
LaserR->SetHiddenInGame(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user