Advertisement
Guest User

Untitled

a guest
Apr 18th, 2016
1,326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.99 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "GameFramework/Character.h"
  6. #include "BaseCharacter_C.generated.h"
  7.  
  8. UCLASS()
  9. class FPS2_API ABaseCharacter_C : public ACharacter
  10. {
  11.     GENERATED_BODY()
  12.  
  13. public:
  14.     // Sets default values for this character's properties
  15.     ABaseCharacter_C();
  16.  
  17.     // Called when the game starts or when spawned
  18.     virtual void BeginPlay() override;
  19.  
  20.     // Called every frame
  21.     virtual void Tick(float DeltaSeconds) override;
  22.  
  23.     // Called to bind functionality to input
  24.     virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
  25.  
  26. public:
  27.  
  28.     //Step 2: Expose a float property
  29.     UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "BaseCharacter")
  30.     float HealthMax = 100.0f;
  31.  
  32.     //Step 2: Expose a float property
  33.     UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "BaseCharacter")
  34.     float Health = 100.0f;
  35.  
  36.     // Health percentage between 0.0 and 1.0
  37.     UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "BaseCharacter")
  38.     float HealthPerc = 1.0f;
  39.  
  40.     //Step 3: Expose a boolean property
  41.     UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "BaseCharacter")
  42.     bool IsDead = false;
  43.  
  44.  
  45.     //Step 4: Make a helper function, just because we are lazy
  46.     virtual void CalculateDead();
  47.  
  48.     //Step 5: Expose a method
  49.     UFUNCTION(BlueprintCallable, Category = "BaseCharacter")
  50.     virtual void CalculateHealth(float delta);
  51.  
  52.     UFUNCTION(BlueprintCallable, Category = "BaseCharacter")
  53.     virtual void Kill();
  54.  
  55.     //// Create Event
  56.     //UFUNCTION(BlueprintImplementableEvent,  meta = (FriendlyName = "When Player Dies")) // Category = "BaseCharacter",
  57.     //virtual void OnDeath();
  58.  
  59.     //Step 6: Editor code to make updating values in the editor cleaner
  60. #if WITH_EDITOR
  61.     virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
  62. #endif
  63.  
  64.     // Create Event
  65.     UFUNCTION(BlueprintImplementableEvent, Category = "BaseCharacter")
  66.     void OnDeath();
  67.     void OnDeath_Implementation();
  68. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement