fix day logick and use item

This commit is contained in:
2020-06-15 17:28:25 +05:00
parent dbd61f909e
commit 0a601c972d
7 changed files with 19 additions and 4 deletions
+7 -1
View File
@@ -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;
}
+6 -2
View File
@@ -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()
{
}
+1 -1
View File
@@ -57,7 +57,7 @@ protected:
UFUNCTION()
void OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
UFUNCTION(BlueprintCallable, Category = "Functions")
+5
View File
@@ -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: