diff --git a/SeagullGame/Content/Items/BPI_CubeTransparent.uasset b/SeagullGame/Content/Items/BPI_CubeTransparent.uasset new file mode 100644 index 0000000..a833cdf --- /dev/null +++ b/SeagullGame/Content/Items/BPI_CubeTransparent.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cc70449d8658343d5d6ed5c484bcf9aaf0c675d78e3051b439bc82b49ad0bda +size 27203 diff --git a/SeagullGame/Content/Items/M_CravingTransparent.uasset b/SeagullGame/Content/Items/M_CravingTransparent.uasset new file mode 100644 index 0000000..1f92d78 --- /dev/null +++ b/SeagullGame/Content/Items/M_CravingTransparent.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5238c7b8150ac6da16c793a30ab4d4a8ed3c743c48d0a6404252138883da006f +size 9045 diff --git a/SeagullGame/Content/TopDown/Blueprints/SKM_Quinn_Socket.uasset b/SeagullGame/Content/TopDown/Blueprints/SKM_Quinn_Socket.uasset index 5536ea4..3d85758 100644 --- a/SeagullGame/Content/TopDown/Blueprints/SKM_Quinn_Socket.uasset +++ b/SeagullGame/Content/TopDown/Blueprints/SKM_Quinn_Socket.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4d57816d0d19885cd64768574bf2c0d8702369fceed8773d5745d83e7eaf12d +oid sha256:82c6f92b4150aa1becdf56cf8aebf1a41ce713872d7a3daedda9a1b4778a2743 size 36495756 diff --git a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp index 7d45aa0..14a5ecf 100644 --- a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp +++ b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp @@ -136,6 +136,19 @@ void ASeagullGameCharacter::StartGame() GetWorld()->GetTimerManager().ClearTimer(GameTimerHandle); } GetWorld()->GetTimerManager().SetTimer(GameTimerHandle, this, &ASeagullGameCharacter::EndGame, GameTime, false); + + FTimerHandle CravingTimerHandle; + GetWorld()->GetTimerManager().SetTimer(CravingTimerHandle, [this]() + { + TSubclassOf ItemActor = ItemActors[FMath::RandRange(0, ItemActors.Num() - 1)]; + if (IsValid(CravingItemActor)) CravingItemActor->Destroy(); + CravingItemActor = GetWorld()->SpawnActor(ItemActor); + CurrentCraving = Cast(CravingItemActor)->ItemType; + CravingItemActor->SetActorEnableCollision(false); + USkeletalMeshComponent* MeshComponent = GetMesh(); + if (!MeshComponent->HasAnySockets()) return; + CravingItemActor->AttachToComponent(MeshComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale, "CravingSocket"); + }, 30, true, 3); } void ASeagullGameCharacter::EndGame() diff --git a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h index 1350cf5..0ce0fc3 100644 --- a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h +++ b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h @@ -100,6 +100,10 @@ public: UBoxComponent* PickupBox; UPROPERTY(BlueprintReadOnly, Category = "Item") EItemType CurrentCraving; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item") + TArray> ItemActors; + UPROPERTY(BlueprintReadOnly, Category = "Item") + AActor* CravingItemActor; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "John") float JohnsCurrentHunger = 0;