-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hero.h
122 lines (77 loc) · 2.52 KB
/
Hero.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#pragma once
#include "Weapon.h"
#include "Usable.h"
#include "GameFramework/Character.h"
#include "Hero.generated.h"
#define COLLISION_ITEM ECC_GameTraceChannel1
/**
*
*/
UCLASS()
class MUTANTSURVIVAL_API AHero : public ACharacter
{
GENERATED_UCLASS_BODY()
/** First person camera */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
TSubobjectPtr<UCameraComponent> FirstPersonCameraComponent;
public:
float getHealth();
UFUNCTION(reliable, server, WithValidation)
void reloadWeapon();
protected:
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = Atttributes)
bool bReloading;
void OnClientFire();
float reloadTime;
void onFireClient();
UFUNCTION(reliable, server, WithValidation)
void serverFire();
bool bCanFire;
void reloadDone();
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
virtual void Tick(float DeltaSeconds) override;
virtual void ReceiveAnyDamage(float Damage, const class UDamageType* DamageType, class AController* InstigatedBy, class AActor* DamageCauser) override;
TArray<AWeapon*> inventory;
//handles moving forward/backward
UFUNCTION()
void MoveForward(float Val);
//handles strafing
UFUNCTION()
void MoveRight(float Val);
UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
TSubobjectPtr<USkeletalMeshComponent> FirstPersonMesh;
//sets jump flag when key is pressed
UFUNCTION()
void OnStartJump();
//clears jump flag when key is released
UFUNCTION()
void OnStopJump();
UFUNCTION(reliable, server, WithValidation)
void StopFire();
void OnFire();
UFUNCTION(reliable, server, WithValidation)
void equipPrevWeapon();
UFUNCTION(reliable, server, WithValidation)
void equipNextWeapon();
UFUNCTION(reliable, server, WithValidation)
void OnUse();
void equip(AWeapon* x);
int32 currentWeaponIndex;
virtual void PostInitializeComponents() override;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Gameplay)
float pickUpRadius;
IUsable * UseFocus;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = LOL)
TSubobjectPtr<USceneComponent> helper;
FHitResult useHit;
public:
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = Atttributes)
AWeapon* currentWeapon;
AWeapon* lastWeapon;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Atttributes)
FVector GunOffset;
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = Attributes)
float health;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Attributes)
float maxHealth;
};