Update John to Have Cravings Displayed on Head
This commit is contained in:
parent
19cc9057c2
commit
8e197d7c64
BIN
SeagullGame/Content/John/BP_John.uasset
(Stored with Git LFS)
BIN
SeagullGame/Content/John/BP_John.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
SeagullGame/Content/John/John_standing_geared_uo.uasset
(Stored with Git LFS)
Normal file
BIN
SeagullGame/Content/John/John_standing_geared_uo.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
SeagullGame/Content/John/Material/John_standing_geared_uo_standardSurface1_BaseColor.uasset
(Stored with Git LFS)
Normal file
BIN
SeagullGame/Content/John/Material/John_standing_geared_uo_standardSurface1_BaseColor.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
SeagullGame/Content/John/Material/John_standing_geared_uo_standardSurface1_Normal.uasset
(Stored with Git LFS)
Normal file
BIN
SeagullGame/Content/John/Material/John_standing_geared_uo_standardSurface1_Normal.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
SeagullGame/Content/John/Material/John_standing_geared_uo_standardSurface1_OcclusionRoughnessMetallic.uasset
(Stored with Git LFS)
Normal file
BIN
SeagullGame/Content/John/Material/John_standing_geared_uo_standardSurface1_OcclusionRoughnessMetallic.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
SeagullGame/Content/John/Material/M_JohnGearedUp.uasset
(Stored with Git LFS)
Normal file
BIN
SeagullGame/Content/John/Material/M_JohnGearedUp.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -15,6 +15,7 @@
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "Materials/Material.h"
|
||||
#include "Engine/World.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
ASeagullGameCharacter::ASeagullGameCharacter()
|
||||
{
|
||||
@ -92,7 +93,12 @@ void ASeagullGameCharacter::Tick(float DeltaSeconds)
|
||||
void ASeagullGameCharacter::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
TArray<AActor*> Johns;
|
||||
UGameplayStatics::GetAllActorsWithTag(GetWorld(), FName("John"), Johns);
|
||||
if (Johns.Num() > 0)
|
||||
{
|
||||
John = Johns[0];
|
||||
}
|
||||
//Add Input Mapping Context
|
||||
if (APlayerController* PlayerController = Cast<APlayerController>(Controller))
|
||||
{
|
||||
@ -145,10 +151,11 @@ void ASeagullGameCharacter::StartGame()
|
||||
CravingItemActor = GetWorld()->SpawnActor(ItemActor);
|
||||
CurrentCraving = Cast<AItemActor>(CravingItemActor)->ItemType;
|
||||
CravingItemActor->SetActorEnableCollision(false);
|
||||
USkeletalMeshComponent* MeshComponent = GetMesh();
|
||||
if (!IsValid(John)) return;
|
||||
UStaticMeshComponent* MeshComponent = Cast<UStaticMeshComponent>(John->GetComponentByClass(UStaticMeshComponent::StaticClass()));
|
||||
if (!MeshComponent->HasAnySockets()) return;
|
||||
CravingItemActor->AttachToComponent(MeshComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale, "CravingSocket");
|
||||
}, 30, true, 3);
|
||||
}, 60, true, 2);
|
||||
}
|
||||
|
||||
void ASeagullGameCharacter::EndGame()
|
||||
@ -210,6 +217,7 @@ void ASeagullGameCharacter::DropItem()
|
||||
CurrentItem->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
|
||||
FVector DropLocation = MeshComponent->GetSocketLocation("ItemSocket");
|
||||
DropLocation += GetActorForwardVector() * 100;
|
||||
DropLocation += GetActorUpVector() * 50;
|
||||
GetWorld()->SpawnActor(Cast<AItemActor>(CurrentItem)->ItemNoPhysics, &DropLocation);
|
||||
CurrentItem->Destroy();
|
||||
CurrentItem = nullptr;
|
||||
|
@ -123,6 +123,8 @@ public:
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Item")
|
||||
AActor* CravingItemActor;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "John")
|
||||
AActor* John;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "John")
|
||||
float JohnsCurrentHunger = 0;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "John")
|
||||
|
Loading…
Reference in New Issue
Block a user