diff --git a/Content/Enemies/Small/BP_SmallEnemy.uasset b/Content/Enemies/Small/BP_SmallEnemy.uasset index bb3212e..cfb9bf4 100644 --- a/Content/Enemies/Small/BP_SmallEnemy.uasset +++ b/Content/Enemies/Small/BP_SmallEnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01a29b22cee6797c1a542ff9d2e25a2c922b50d38a3c4665479596d4db3b7c1c -size 242756 +oid sha256:2199283424157853d6a16a7900d1b12fa0f77d8949a16452dc78dee3c84944bc +size 281385 diff --git a/Content/Enemies/Small/BTT_Attack.uasset b/Content/Enemies/Small/BTT_Attack.uasset new file mode 100644 index 0000000..8e35a54 --- /dev/null +++ b/Content/Enemies/Small/BTT_Attack.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff9a79f6b69317d6043835a7a1b1b8b303bea390705d1b8ade65dca5ee9981f5 +size 23156 diff --git a/Content/Enemies/Small/BT_SmallEnemy.uasset b/Content/Enemies/Small/BT_SmallEnemy.uasset index c5fb819..40da8e2 100644 --- a/Content/Enemies/Small/BT_SmallEnemy.uasset +++ b/Content/Enemies/Small/BT_SmallEnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:840b4fbfbe98d5b81b10d3bb690dca162f710d9b52ed4ccfeb3e26b15a94a0f9 -size 18418 +oid sha256:fbf66b0149e650919d6cbb1979f3a8b8802c2054bfcf7171322a8999b2c4bf5a +size 21338 diff --git a/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index ea50ca3..d340ee3 100644 --- a/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:89060747c2145def58d57943b0b333c5f5b216c9c7107582d76a9454a3d82de8 -size 342019 +oid sha256:fb266b59e5b7c4e75a292a1286580467af352967648e0e71c231d37f3b43df64 +size 414132 diff --git a/Content/Levels/PrototypeLevel.umap b/Content/Levels/PrototypeLevel.umap index 5619abe..a23a2a8 100644 --- a/Content/Levels/PrototypeLevel.umap +++ b/Content/Levels/PrototypeLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27fb8937749a5b4d9cf62ab0454166535ddcdbd80d95c0e73d11a4cc2b4fecb3 -size 8486661 +oid sha256:b6ed9c4636a2ca2e2f522c7e8eaf881337d9fcda642b3a6fc6894bff8a016c74 +size 8601472 diff --git a/Content/Monolith/UI/WBP_Died.uasset b/Content/Monolith/UI/WBP_Died.uasset new file mode 100644 index 0000000..66b2cc2 --- /dev/null +++ b/Content/Monolith/UI/WBP_Died.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ef91a92f9ad386a535470b2c889038ba121058edc1485684b91396955c31ebc +size 35921 diff --git a/Source/Monolith/MonolithCharacter.cpp b/Source/Monolith/MonolithCharacter.cpp index d60a6b6..532ce2a 100644 --- a/Source/Monolith/MonolithCharacter.cpp +++ b/Source/Monolith/MonolithCharacter.cpp @@ -46,6 +46,7 @@ void AMonolithCharacter::BeginPlay() // Call the base class Super::BeginPlay(); + MaxHealth = Health; Mesh1P = Cast(GetComponentByClass(USkeletalMeshComponent::StaticClass())); CharMove = Cast(GetComponentByClass(UCharacterMovementComponent::StaticClass())); if (CharMove) WalkSpeed = CharMove->MaxWalkSpeed; @@ -122,6 +123,19 @@ static void UpdateMoveState(FMoveState& MoveState, int Forwards, int Sideways) } } +void AMonolithCharacter::IncrementHealth(float amount) +{ + Health += amount; + if (Health > MaxHealth) + { + Health = MaxHealth; + } + else if (Health <= 0) + { + Died(); + } +} + void AMonolithCharacter::Move(const FInputActionValue& Value) { // input is a Vector2D diff --git a/Source/Monolith/MonolithCharacter.h b/Source/Monolith/MonolithCharacter.h index b7a5d0d..4019309 100644 --- a/Source/Monolith/MonolithCharacter.h +++ b/Source/Monolith/MonolithCharacter.h @@ -58,6 +58,11 @@ class AMonolithCharacter : public ACharacter // Amount of impulse to add when dashing UPROPERTY(EditAnywhere, Category = "MoveState", meta=(AllowPrivateAccess = "true")) float DashImpulse = 600.f; + + UPROPERTY(EditDefaultsOnly, Category = "Health", meta=(AllowPrivateAccess = "true")) + float Health = 100.f; + + float MaxHealth; USkeletalMeshComponent* Mesh1P; UCharacterMovementComponent* CharMove; @@ -70,6 +75,25 @@ protected: void BeginPlay(); void Tick(float DeltaSeconds) override; + UFUNCTION(BlueprintCallable) + float GetHealth() + { + return Health; + } + + UFUNCTION(BlueprintCallable) + void ResetHealth() + { + Health = MaxHealth; + } + + // Increase/Decrease health by this amount, will handle death + UFUNCTION(BlueprintCallable) + void IncrementHealth(float amount); + + UFUNCTION(BlueprintImplementableEvent) + void Died(); + /** Called for movement input */ void Move(const FInputActionValue& Value); void StopMove();