add go to bed
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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<USceneComponent>(TEXT("Root"));
|
||||||
|
RootComponent = Root;
|
||||||
|
|
||||||
|
Body = CreateAbstractDefaultSubobject<UStaticMeshComponent>(TEXT("Body"));
|
||||||
|
Body->SetupAttachment(Root);
|
||||||
|
BoxCollision = CreateDefaultSubobject<UBoxComponent>(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);
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ void AFemale::BeginPlay()
|
|||||||
capsule->OnComponentEndOverlap.AddDynamic(this, &AFemale::OnOverlapEnd);
|
capsule->OnComponentEndOverlap.AddDynamic(this, &AFemale::OnOverlapEnd);
|
||||||
maxMood = 0.0f;
|
maxMood = 0.0f;
|
||||||
currentMood = 0.0f;
|
currentMood = 0.0f;
|
||||||
|
isGoToBed = false;
|
||||||
GetData();
|
GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,17 +39,17 @@ void AFemale::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherA
|
|||||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
||||||
const FHitResult& SweepResult)
|
const FHitResult& SweepResult)
|
||||||
{
|
{
|
||||||
|
if(!isGoToBed)
|
||||||
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("not in place"), InPlace);
|
|
||||||
ItemForWork = Cast<ABaseItem>(OtherActor);
|
|
||||||
if (!ItemForWork->used && ItemForWork->nameItem == NameItem)
|
|
||||||
{
|
{
|
||||||
GetWorldTimerManager().SetTimer(MemberTimerHandle, this, &AFemale::StartUseItem, 0.5f, false);
|
UE_LOG(LogTemp, Warning, TEXT("not in place"), InPlace);
|
||||||
//StartUseItem();
|
ItemForWork = Cast<ABaseItem>(OtherActor);
|
||||||
UE_LOG(LogTemp, Warning, TEXT("start anim working"));
|
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,
|
void AFemale::OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
|
||||||
@@ -89,6 +90,7 @@ void AFemale::CheckingUpset()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AFemale::MoodDecreace()
|
void AFemale::MoodDecreace()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -114,7 +116,10 @@ void AFemale::EndUseItem_Implementation()
|
|||||||
void AFemale::whatShouldIDo_Implementation()
|
void AFemale::whatShouldIDo_Implementation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void AFemale::SetIsGoToBed(bool goes)
|
||||||
|
{
|
||||||
|
isGoToBed = goes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called every frame
|
// Called every frame
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
};
|
||||||
@@ -54,6 +54,8 @@ protected:
|
|||||||
FName NameItem;
|
FName NameItem;
|
||||||
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category= "Data")
|
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category= "Data")
|
||||||
UWBIFGameInstance* gameInstance;
|
UWBIFGameInstance* gameInstance;
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Data")
|
||||||
|
bool isGoToBed;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ public:
|
|||||||
|
|
||||||
// Called to bind functionality to input
|
// Called to bind functionality to input
|
||||||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||||
|
|
||||||
// ===================Functions===================================
|
// ===================Functions===================================
|
||||||
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category = "Animations")
|
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category = "Animations")
|
||||||
void SartAnimUseItem();
|
void SartAnimUseItem();
|
||||||
@@ -71,6 +73,8 @@ public:
|
|||||||
void EndUseItem();
|
void EndUseItem();
|
||||||
UFUNCTION(BlueprintCallable, Category = "Mood")
|
UFUNCTION(BlueprintCallable, Category = "Mood")
|
||||||
void CheckingUpset();
|
void CheckingUpset();
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Dta")
|
||||||
|
void SetIsGoToBed(bool goes);
|
||||||
|
|
||||||
// ===================Variable===================================
|
// ===================Variable===================================
|
||||||
UPROPERTY() // variable for timer
|
UPROPERTY() // variable for timer
|
||||||
|
|||||||
Reference in New Issue
Block a user