diff --git a/Content/BP/BP_Bed.uasset b/Content/BP/BP_Bed.uasset new file mode 100644 index 0000000..6819896 Binary files /dev/null and b/Content/BP/BP_Bed.uasset differ diff --git a/Content/BP/female/BP_Female.uasset b/Content/BP/female/BP_Female.uasset index 44f6fe6..3885e34 100644 Binary files a/Content/BP/female/BP_Female.uasset and b/Content/BP/female/BP_Female.uasset differ diff --git a/Content/BP/gameMode/BP_WBIFGameModeBase.uasset b/Content/BP/gameMode/BP_WBIFGameModeBase.uasset index 8688da9..a744e3e 100644 Binary files a/Content/BP/gameMode/BP_WBIFGameModeBase.uasset and b/Content/BP/gameMode/BP_WBIFGameModeBase.uasset differ diff --git a/Content/BP/player/BP_PlayerCharacter.uasset b/Content/BP/player/BP_PlayerCharacter.uasset index a4898d3..5a80810 100644 Binary files a/Content/BP/player/BP_PlayerCharacter.uasset and b/Content/BP/player/BP_PlayerCharacter.uasset differ diff --git a/Content/assets/Meshes/SM_Bed_1A.uasset b/Content/assets/Meshes/SM_Bed_1A.uasset index f42fbc8..81505d2 100644 Binary files a/Content/assets/Meshes/SM_Bed_1A.uasset and b/Content/assets/Meshes/SM_Bed_1A.uasset differ diff --git a/Content/maps/test_map.umap b/Content/maps/test_map.umap index cacf0fc..dfb5ec6 100644 Binary files a/Content/maps/test_map.umap and b/Content/maps/test_map.umap differ diff --git a/Source/WBIF/Private/Bed.cpp b/Source/WBIF/Private/Bed.cpp new file mode 100644 index 0000000..0450cbd --- /dev/null +++ b/Source/WBIF/Private/Bed.cpp @@ -0,0 +1,35 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Bed.h" + +// Sets default values +ABed::ABed() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + Root = CreateDefaultSubobject(TEXT("Root")); + RootComponent = Root; + + Body = CreateAbstractDefaultSubobject(TEXT("Body")); + Body->SetupAttachment(Root); + BoxCollision = CreateDefaultSubobject(TEXT("Box Collision")); + BoxCollision->SetupAttachment(Root); +} + +// Called when the game starts or when spawned +void ABed::BeginPlay() +{ + Super::BeginPlay(); + +} + + +/* +// Called every frame +void ABed::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +}*/ + diff --git a/Source/WBIF/Private/Female.cpp b/Source/WBIF/Private/Female.cpp index ede2454..9dd54e9 100644 --- a/Source/WBIF/Private/Female.cpp +++ b/Source/WBIF/Private/Female.cpp @@ -23,6 +23,7 @@ void AFemale::BeginPlay() capsule->OnComponentEndOverlap.AddDynamic(this, &AFemale::OnOverlapEnd); maxMood = 0.0f; currentMood = 0.0f; + isGoToBed = false; GetData(); } @@ -38,17 +39,17 @@ void AFemale::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherA UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) { - - - UE_LOG(LogTemp, Warning, TEXT("not in place"), InPlace); - ItemForWork = Cast(OtherActor); - if (!ItemForWork->used && ItemForWork->nameItem == NameItem) + if(!isGoToBed) { - GetWorldTimerManager().SetTimer(MemberTimerHandle, this, &AFemale::StartUseItem, 0.5f, false); - //StartUseItem(); - UE_LOG(LogTemp, Warning, TEXT("start anim working")); + UE_LOG(LogTemp, Warning, TEXT("not in place"), InPlace); + ItemForWork = Cast(OtherActor); + if (!ItemForWork->used && ItemForWork->nameItem == NameItem) + { + GetWorldTimerManager().SetTimer(MemberTimerHandle, this, &AFemale::StartUseItem, 0.5f, false); + //StartUseItem(); + UE_LOG(LogTemp, Warning, TEXT("start anim working")); + } } - } void AFemale::OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, @@ -89,6 +90,7 @@ void AFemale::CheckingUpset() } } + void AFemale::MoodDecreace() { @@ -114,7 +116,10 @@ void AFemale::EndUseItem_Implementation() void AFemale::whatShouldIDo_Implementation() { } - +void AFemale::SetIsGoToBed(bool goes) +{ + isGoToBed = goes; +} // Called every frame diff --git a/Source/WBIF/Public/Bed.h b/Source/WBIF/Public/Bed.h new file mode 100644 index 0000000..3e15361 --- /dev/null +++ b/Source/WBIF/Public/Bed.h @@ -0,0 +1,35 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "Components/BoxComponent.h" +#include "Bed.generated.h" + +UCLASS() +class WBIF_API ABed : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + ABed(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + // ===================Variables=================================== + + UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = "Objects") + USceneComponent* Root; + UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = "Objects") + UStaticMeshComponent* Body; + UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = "Objects") + UBoxComponent* BoxCollision; + +public: + // Called every frame + //virtual void Tick(float DeltaTime) override; + +}; diff --git a/Source/WBIF/Public/Female.h b/Source/WBIF/Public/Female.h index a79b665..6b5528e 100644 --- a/Source/WBIF/Public/Female.h +++ b/Source/WBIF/Public/Female.h @@ -54,6 +54,8 @@ protected: FName NameItem; UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category= "Data") UWBIFGameInstance* gameInstance; + UPROPERTY(EditAnywhere, Category = "Data") + bool isGoToBed; @@ -63,7 +65,7 @@ public: // Called to bind functionality to input virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; - + // ===================Functions=================================== UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category = "Animations") void SartAnimUseItem(); @@ -71,6 +73,8 @@ public: void EndUseItem(); UFUNCTION(BlueprintCallable, Category = "Mood") void CheckingUpset(); + UFUNCTION(BlueprintCallable, Category = "Dta") + void SetIsGoToBed(bool goes); // ===================Variable=================================== UPROPERTY() // variable for timer