Add UI to Show Held & Craving

This commit is contained in:
Philip W 2024-01-28 11:24:13 +00:00
parent 607a070ca3
commit c24681e781
31 changed files with 77 additions and 50 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
SeagullGame/Content/Items/BPI_Bread.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
SeagullGame/Content/Mart.umap (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Car.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Mop.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Texture/M_Car.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Texture/M_MopBucket.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Texture/M_MopRed.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Texture/M_MopWhite.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Texture/M_StickBrown.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
SeagullGame/Content/Ossie_Props/Texture/M_WetFloor.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
SeagullGame/Content/UI/BP_HUD.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -155,6 +155,17 @@ void ASeagullGameCharacter::StartGame()
UStaticMeshComponent* MeshComponent = Cast<UStaticMeshComponent>(John->GetComponentByClass(UStaticMeshComponent::StaticClass()));
if (!MeshComponent->HasAnySockets()) return;
CravingItemActor->AttachToComponent(MeshComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale, "CravingSocket");
FString CravingString = UEnum::GetValueAsString(CurrentCraving);
CravingString.Split(FString("::"), nullptr, &CravingString);
for (int i = 0; i < CravingString.Len(); i++)
{
if (CravingString[i] >= 'A' && CravingString[i] <= 'Z')
{
CravingString.InsertAt(i, " ");
i++;
}
}
CravingItemName = CravingString;
}, 60, true, 2);
}
@ -208,6 +219,17 @@ void ASeagullGameCharacter::PickupItem()
CurrentItem->AttachToComponent(MeshComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale, "ItemSocket");
CurrentItem->SetActorEnableCollision(false);
ClosestItemActor->Destroy();
FString HeldItemString = UEnum::GetValueAsString(Cast<AItemActor>(CurrentItem)->ItemType);
HeldItemString.Split(FString("::"), nullptr, &HeldItemString);
for (int i = 0; i < HeldItemString.Len(); i++)
{
if (HeldItemString[i] >= 'A' && HeldItemString[i] <= 'Z')
{
HeldItemString.InsertAt(i, " ");
i++;
}
}
HeldItemName = HeldItemString;
}
void ASeagullGameCharacter::DropItem()
@ -221,6 +243,7 @@ void ASeagullGameCharacter::DropItem()
GetWorld()->SpawnActor(Cast<AItemActor>(CurrentItem)->ItemNoPhysics, &DropLocation);
CurrentItem->Destroy();
CurrentItem = nullptr;
HeldItemName = "";
}
void ASeagullGameCharacter::OnPickupBoxBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)

View File

@ -122,6 +122,10 @@ public:
TArray<TSubclassOf<AItemActor>> ItemActors;
UPROPERTY(BlueprintReadOnly, Category = "Item")
AActor* CravingItemActor;
UPROPERTY(BlueprintReadOnly, Category = "Item")
FString CravingItemName;
UPROPERTY(BlueprintReadOnly, Category = "Item")
FString HeldItemName;
UPROPERTY(BlueprintReadOnly, Category = "John")
AActor* John;