Skip to content

Commit 3253c41

Browse files
committed
Some refactoring
1 parent 41e2d6c commit 3253c41

File tree

15 files changed

+53
-53
lines changed

15 files changed

+53
-53
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:11b1e15d9628c9c5a5c2569e422271276c97b35596e13c87f2d4dc4f589bb3b6
3-
size 116023
2+
oid sha256:f5a9eb090f61f4213ffb3adcf7a7239d0294d25c085b3c184afff1debd333c31
3+
size 58334
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:133fcc0cddf996bbde2a5abc30908a4fe7ba14de2de797b34cba0bedd8801f55
3-
size 34223
2+
oid sha256:9fc9d144be505cb6228010d9b2349ab68d3550b5251045f8c2d6529324d421ca
3+
size 34263

Content/Maps/TestMap.umap

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:0f3618dd021d5828076e558c42ba21cfd49b9cf9bc38fda3a24b2b8826142179
3-
size 139946
2+
oid sha256:fbe7b7b97cbe767d84ebfc3ee695b910ecb3518d7d78363d0865fdf6f901db5a
3+
size 137035

Source/ProjectSlash/Breakables/BreakableActor.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ class PROJECTSLASH_API ABreakableActor : public AActor, public IHitInterface
2929
private:
3030

3131
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
32-
UGeometryCollectionComponent* GeometryCollection = nullptr;
32+
TObjectPtr<UGeometryCollectionComponent> GeometryCollection;
3333

3434
// this is needed for the `SpawnActor` method in World. We need to specify a class for the template function (in particular a BP class and not a c++ one)... In order to do this we can use the UClass and specify it in BP_BreakableActor
3535
// Below we use `TSubclassOf` wrapper to specify which class we want! This restricts it to ATreasure class or anything derived from it! More effective than UClass*
3636
UPROPERTY(EditAnywhere)
3737
TSubclassOf<ATreasure> TreasureClass;
3838

3939
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
40-
UCapsuleComponent* Capsule = nullptr;
40+
TObjectPtr<UCapsuleComponent> Capsule;
4141

4242
};

Source/ProjectSlash/Characters/BaseCharacter.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ class PROJECTSLASH_API ABaseCharacter : public ACharacter, public IHitInterface
3535
virtual void GetHit(const FVector& ImpactPoint, AActor* Hitter) override;
3636

3737
UPROPERTY(VisibleAnywhere, Category = "Weapon")
38-
AWeapon* EquippedWeapon = nullptr;
38+
TObjectPtr<AWeapon> EquippedWeapon;
3939

4040
UPROPERTY(VisibleAnywhere, Category = "Weapon")
41-
ATwoWeapons* TwoWeapons = nullptr;
41+
TObjectPtr<ATwoWeapons> TwoWeapons;
4242

4343

4444
virtual void Attack();
4545

4646
virtual void Die();
4747

4848
UPROPERTY(VisibleAnywhere)
49-
UAttributeComponent* Attribute = nullptr;
49+
TObjectPtr<UAttributeComponent> Attribute;
5050

5151
/**
5252
* Play Montage Functions
@@ -74,7 +74,7 @@ class PROJECTSLASH_API ABaseCharacter : public ACharacter, public IHitInterface
7474
void StopAttackMontage();
7575

7676
UPROPERTY(BlueprintReadOnly, Category = "Combat")
77-
AActor* CombatTarget = nullptr;
77+
TObjectPtr<AActor> CombatTarget;
7878

7979
UPROPERTY(EditAnywhere, Category = "Combat")
8080
double WarpTargetDistance = 75.f;
@@ -92,16 +92,16 @@ class PROJECTSLASH_API ABaseCharacter : public ACharacter, public IHitInterface
9292

9393
/** Animation Montages */
9494
UPROPERTY(EditDefaultsOnly, Category = "Montages")
95-
UAnimMontage* AttackMontage = nullptr;
95+
TObjectPtr<UAnimMontage> AttackMontage;
9696

9797
UPROPERTY(EditDefaultsOnly, Category = "Montages")
98-
UAnimMontage* HitReactMontage = nullptr;
98+
TObjectPtr<UAnimMontage> HitReactMontage;
9999

100100
UPROPERTY(EditDefaultsOnly, Category = "Montages")
101-
UAnimMontage* DeathMontage = nullptr;
101+
TObjectPtr<UAnimMontage> DeathMontage;
102102

103103
UPROPERTY(EditDefaultsOnly, Category = "Montages")
104-
UAnimMontage* DodgeMontage = nullptr;
104+
TObjectPtr<UAnimMontage> DodgeMontage;
105105

106106
UPROPERTY(EditAnywhere, Category = "Montages")
107107
TArray<FName> AttackMontageSections;

Source/ProjectSlash/Characters/SlashAnimInstance.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PROJECTSLASH_API USlashAnimInstance : public UAnimInstance
2424
ASlashCharacter* Character = nullptr;
2525

2626
UPROPERTY(BlueprintReadOnly, Category = "Movement")
27-
UCharacterMovementComponent* CharacterMovement = nullptr;
27+
TObjectPtr<UCharacterMovementComponent> CharacterMovement;
2828

2929
UPROPERTY(BlueprintReadOnly, Category = "Movement")
3030
float GroundSpeed;

Source/ProjectSlash/Characters/SlashCharacter.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -94,53 +94,53 @@ class PROJECTSLASH_API ASlashCharacter : public ABaseCharacter
9494
EActionState ActionState = EActionState::EAS_Unoccupied;
9595

9696
UPROPERTY(VisibleAnywhere)
97-
UCameraComponent* Camera = nullptr;
97+
TObjectPtr<UCameraComponent> Camera;
9898

9999
UPROPERTY(VisibleAnywhere)
100-
USpringArmComponent* CameraBoom = nullptr;
100+
TObjectPtr<USpringArmComponent> CameraBoom;
101101

102102
UPROPERTY(VisibleAnywhere, Category = "Hair")
103-
UGroomComponent* Hair = nullptr;
103+
TObjectPtr<UGroomComponent> Hair;
104104

105105
UPROPERTY(VisibleAnywhere, Category = "Hair")
106-
UGroomComponent* Eyebrows = nullptr;
106+
TObjectPtr<UGroomComponent> Eyebrows;
107107

108108
UPROPERTY(EditAnywhere, Category = "Input")
109-
UInputMappingContext* EchoMappingContext = nullptr;
109+
TObjectPtr<UInputMappingContext> EchoMappingContext;
110110

111111
UPROPERTY(EditAnywhere, Category = "Input")
112-
UInputAction* MoveAction = nullptr;
112+
TObjectPtr<UInputAction> MoveAction;
113113

114114
UPROPERTY(EditAnywhere, Category = "Input")
115-
UInputAction* LookAction = nullptr;
115+
TObjectPtr<UInputAction> LookAction;
116116

117117
UPROPERTY(EditAnywhere, Category = "Input")
118-
UInputAction* JumpAction = nullptr;
118+
TObjectPtr<UInputAction> JumpAction;
119119

120120
UPROPERTY(EditAnywhere, Category = "Input")
121-
UInputAction* EKeyAction = nullptr;
121+
TObjectPtr<UInputAction> EKeyAction;
122122

123123
UPROPERTY(EditAnywhere, Category = "Input")
124-
UInputAction* AttackAction = nullptr;
124+
TObjectPtr<UInputAction> AttackAction;
125125

126126
UPROPERTY(EditAnywhere, Category = "Input")
127-
UInputAction* TauntAction = nullptr;
127+
TObjectPtr<UInputAction> TauntAction;
128128

129129
UPROPERTY(EditAnywhere, Category = "Input")
130-
UInputAction* KickAction = nullptr;
131-
130+
TObjectPtr<UInputAction> KickAction;
131+
132132
UPROPERTY(EditAnywhere, Category = "Input")
133-
UInputAction* DodgeAction = nullptr;
133+
TObjectPtr<UInputAction> DodgeAction;
134134

135135
UPROPERTY(VisibleInstanceOnly)
136-
AItem* OverlappingItem = nullptr;
136+
TObjectPtr<AItem> OverlappingItem;
137137

138138
UPROPERTY(EditDefaultsOnly, Category = "Montages")
139-
UAnimMontage* TauntMontage = nullptr;
139+
TObjectPtr<UAnimMontage> TauntMontage;
140140

141141
UPROPERTY(EditDefaultsOnly, Category = "Montages")
142-
UAnimMontage* EquipMontage = nullptr;
142+
TObjectPtr<UAnimMontage> EquipMontage;
143143

144-
UPlayerOverlay* PlayerOverlay = nullptr;
144+
TObjectPtr<UPlayerOverlay> PlayerOverlay;
145145

146146
};

Source/ProjectSlash/Enemies/Enemy.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class PROJECTSLASH_API AEnemy : public ABaseCharacter
8787

8888
// Current patrol target
8989
UPROPERTY(EditInstanceOnly, Category = "AI Navigation")
90-
AActor* PatrolTarget = nullptr;
90+
TObjectPtr<AActor> PatrolTarget;
9191

9292
// List of patrol destination points
9393
UPROPERTY(EditInstanceOnly, Category = "AI Navigation")

Source/ProjectSlash/HUD/HealthBar.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ class PROJECTSLASH_API UHealthBar : public UUserWidget
1616
public:
1717

1818
UPROPERTY(meta = (BindWidget)) // Will link to the health bar in WBP_HealthBar NOTE: Name must match or link will not work
19-
UProgressBar* HealthBar = nullptr;
19+
TObjectPtr<UProgressBar> HealthBar;
2020

2121
};

Source/ProjectSlash/HUD/HealthBarComponent.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ class PROJECTSLASH_API UHealthBarComponent : public UWidgetComponent
1919
private:
2020

2121
UPROPERTY()
22-
UHealthBar* HealthBarWidget = nullptr;
22+
TObjectPtr<UHealthBar> HealthBarWidget;
2323

2424
};

Source/ProjectSlash/HUD/PlayerHUD.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class PROJECTSLASH_API APlayerHUD : public AHUD
1717

1818
UPROPERTY(EditDefaultsOnly, Category = "PlayerHUD")
1919
TSubclassOf<UPlayerOverlay> PlayerOverlayClass;
20-
UPlayerOverlay* PlayerOverlay = nullptr;
20+
TObjectPtr<UPlayerOverlay> PlayerOverlay;
2121

2222
protected:
2323

Source/ProjectSlash/HUD/PlayerOverlay.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class PROJECTSLASH_API UPlayerOverlay : public UUserWidget
2424
private:
2525

2626
UPROPERTY(meta = (BindWidget))
27-
UProgressBar* HealthProgressBar = nullptr;
27+
TObjectPtr<UProgressBar> HealthProgressBar;
2828

2929
UPROPERTY(meta = (BindWidget))
30-
UProgressBar* StaminaProgressBar = nullptr;
30+
TObjectPtr<UProgressBar> StaminaProgressBar;
3131

3232
UPROPERTY(meta = (BindWidget))
33-
UTextBlock* GoldCount = nullptr;
33+
TObjectPtr<UTextBlock> GoldCount;
3434

3535
UPROPERTY(meta = (BindWidget))
36-
UTextBlock* SoulsCount = nullptr;
36+
TObjectPtr<UTextBlock> SoulsCount;
3737
};

Source/ProjectSlash/Pickups/Item.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ class PROJECTSLASH_API AItem : public AActor
4242
virtual void OnSphereEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
4343

4444
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Mesh")
45-
UStaticMeshComponent* Mesh = nullptr;
45+
TObjectPtr<UStaticMeshComponent> Mesh;
4646

4747
EItemState ItemState = EItemState::EIS_Hovering;
4848

4949
UPROPERTY(VisibleInstanceOnly, Category = "Collision")
50-
USphereComponent* SphereCollider = nullptr;
50+
TObjectPtr<USphereComponent> SphereCollider;
5151

5252
private:
5353

Source/ProjectSlash/Pickups/Treasure.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ class PROJECTSLASH_API ATreasure : public AItem
1818
private:
1919

2020
UPROPERTY(EditAnywhere, Category = "Sounds")
21-
USoundBase* PickupSound = nullptr;
21+
TObjectPtr<USoundBase> PickupSound;
2222
};

Source/ProjectSlash/Pickups/Weapons/TwoWeapons.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ class PROJECTSLASH_API ATwoWeapons : public AItem
3232
private:
3333

3434
UPROPERTY(VisibleInstanceOnly, Category = "Second Mesh")
35-
UStaticMeshComponent* SecondMesh = nullptr;
35+
TObjectPtr<UStaticMeshComponent> SecondMesh;
3636

3737
UPROPERTY(VisibleAnywhere, Category = "Weapon Properties")
38-
UBoxComponent* RightWeaponBox = nullptr;
38+
TObjectPtr<UBoxComponent> RightWeaponBox;
3939

4040
UPROPERTY(VisibleAnywhere) // Typically "VisibleAnywhere" is used for USceneComponents whereas variables will have "EditAnywhere"
41-
USceneComponent* RightBoxTraceStart = nullptr;
41+
TObjectPtr<USceneComponent> RightBoxTraceStart;
4242

4343
UPROPERTY(VisibleAnywhere)
44-
USceneComponent* RightBoxTraceEnd = nullptr;
44+
TObjectPtr<USceneComponent> RightBoxTraceEnd;
4545

4646
UPROPERTY(VisibleAnywhere, Category = "Weapon Properties")
47-
UBoxComponent* LeftWeaponBox = nullptr;
47+
TObjectPtr<UBoxComponent> LeftWeaponBox;
4848

4949
UPROPERTY(VisibleAnywhere)
50-
USceneComponent* LeftBoxTraceStart = nullptr;
50+
TObjectPtr<USceneComponent> LeftBoxTraceStart;
5151

5252
UPROPERTY(VisibleAnywhere)
53-
USceneComponent* LeftBoxTraceEnd = nullptr;
53+
TObjectPtr<USceneComponent> LeftBoxTraceEnd;
5454
};

0 commit comments

Comments
 (0)