diff --git a/Content/BP/female/BP_Female.uasset b/Content/BP/female/BP_Female.uasset index b64f51d..9a6913f 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 5eef8ed..cd1b786 100644 Binary files a/Content/BP/gameMode/BP_WBIFGameModeBase.uasset and b/Content/BP/gameMode/BP_WBIFGameModeBase.uasset differ diff --git a/Content/maps/test_map.umap b/Content/maps/test_map.umap index a831ea6..3a9b3f9 100644 Binary files a/Content/maps/test_map.umap and b/Content/maps/test_map.umap differ diff --git a/Source/WBIF/Private/BaseItem.cpp b/Source/WBIF/Private/BaseItem.cpp index 6588538..0da2e08 100644 --- a/Source/WBIF/Private/BaseItem.cpp +++ b/Source/WBIF/Private/BaseItem.cpp @@ -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; } diff --git a/Source/WBIF/Private/Female.cpp b/Source/WBIF/Private/Female.cpp index 32c3f66..e7884e3 100644 --- a/Source/WBIF/Private/Female.cpp +++ b/Source/WBIF/Private/Female.cpp @@ -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() +{ +} diff --git a/Source/WBIF/Public/BaseItem.h b/Source/WBIF/Public/BaseItem.h index afb14e0..699e9c0 100644 --- a/Source/WBIF/Public/BaseItem.h +++ b/Source/WBIF/Public/BaseItem.h @@ -57,7 +57,7 @@ protected: UFUNCTION() void OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex); - + UFUNCTION(BlueprintCallable, Category = "Functions") diff --git a/Source/WBIF/Public/Female.h b/Source/WBIF/Public/Female.h index f4d96b2..9b33c2a 100644 --- a/Source/WBIF/Public/Female.h +++ b/Source/WBIF/Public/Female.h @@ -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: