WARNING: It is strongly recommended that you DO NOT copy/paste all of the code at once. If your
project or class have dierent naming in any way, your code will not work. You may, however,
copy/paste the highlighted areas.
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Character.h"
#include "BaseCharacter.generated.h"
//Step 1 : Make class Blueprintable //Must derive from an A* or U* Class
UCLASS(Blueprintable)
class TS_TUTFORLUISANDY_API ABaseCharacter : public ACharacter
{
GENERATED_BODY()
public:
//Step 2: Expose a float property
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "BaseCharacter")
float Health = 100;
//Step 3: Expose a boolean property
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "BaseCharacter")
bool isDead = false;
//Step 4: Make a helper function, just because we are lazy
virtual void CalculateDead();
//Step 5: Expose a method
UFUNCTION(BlueprintCallable, Category = "BaseCharacter")
virtual void CalculateHealth(float delta);
//Step 6: Editor code to make updating values in the editor cleaner
#if WITH_EDITOR
virtual void PostEditChangeProperty(FPropertyChangedEvent&
PropertyChangedEvent) override;
#endif
public:
// Sets default values for this character's properties
ABaseCharacter();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent)
override;