fix day logick and use item
This commit is contained in:
@@ -49,6 +49,9 @@ void ABaseItem::OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherA
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================start used item======================================
|
||||
void ABaseItem::logicOfUsingItems()
|
||||
{
|
||||
@@ -82,11 +85,14 @@ void ABaseItem::logicOfUsingItems()
|
||||
|
||||
void ABaseItem::EndUseItem()
|
||||
{
|
||||
Health -= use;
|
||||
|
||||
if (Health <= 0.0f)
|
||||
{
|
||||
isBroken = true;
|
||||
showBroken();
|
||||
}else
|
||||
{
|
||||
Health -= use;
|
||||
}
|
||||
used = false;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ void AFemale::BeginPlay()
|
||||
capsule = GetCapsuleComponent();
|
||||
capsule->OnComponentBeginOverlap.AddDynamic(this, &AFemale::OnOverlapBegin);
|
||||
capsule->OnComponentEndOverlap.AddDynamic(this, &AFemale::OnOverlapEnd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +60,12 @@ void AFemale::EndUseItem_Implementation()
|
||||
ItemForWork->EndUseItem();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* override functions in BP
|
||||
*/
|
||||
void AFemale::whatShouldIDo_Implementation()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ protected:
|
||||
UFUNCTION()
|
||||
void OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
|
||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
|
||||
|
||||
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Functions")
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "BaseItem.h"
|
||||
#include "GameFramework/GameMode.h"
|
||||
#include "WBIF/WBIFGameModeBase.h"
|
||||
#include "Female.generated.h"
|
||||
|
||||
UCLASS()
|
||||
@@ -31,6 +33,8 @@ protected:
|
||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
|
||||
UFUNCTION(BlueprintCallable, Category = "Use Item")
|
||||
void StartUseItem();
|
||||
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Functions")
|
||||
void whatShouldIDo();
|
||||
|
||||
|
||||
// ===================Variable===================================
|
||||
@@ -41,6 +45,7 @@ protected:
|
||||
UCapsuleComponent* capsule;
|
||||
UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = "Data")
|
||||
FName NameItem;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user