CogSample: Add invisibility cheat

This commit is contained in:
Arnaud Jamin
2025-01-24 00:59:59 -05:00
parent aca54cbe9d
commit 980fe16f6e
6 changed files with 20 additions and 0 deletions
Binary file not shown.
Binary file not shown.
+16
View File
@@ -292,6 +292,7 @@ void ACogSampleCharacter::RegisterToAbilitySystemEvents()
// Register to Tag change events // Register to Tag change events
//---------------------------------------- //----------------------------------------
GhostTagDelegateHandle = AbilitySystem->RegisterGameplayTagEvent(Tag_Status_Ghost, EGameplayTagEventType::NewOrRemoved).AddUObject(this, &ACogSampleCharacter::OnGhostTagNewOrRemoved); GhostTagDelegateHandle = AbilitySystem->RegisterGameplayTagEvent(Tag_Status_Ghost, EGameplayTagEventType::NewOrRemoved).AddUObject(this, &ACogSampleCharacter::OnGhostTagNewOrRemoved);
GhostTagDelegateHandle = AbilitySystem->RegisterGameplayTagEvent(Tag_Status_Invisible, EGameplayTagEventType::NewOrRemoved).AddUObject(this, &ACogSampleCharacter::OnInvisibleTagNewOrRemoved);
//---------------------------------------- //----------------------------------------
// Register to Attribute change events // Register to Attribute change events
@@ -323,6 +324,7 @@ void ACogSampleCharacter::UnregisterFromAbilitySystemEvents()
// Unregister to Tags events // Unregister to Tags events
//---------------------------------------- //----------------------------------------
AbilitySystem->UnregisterGameplayTagEvent(GhostTagDelegateHandle, Tag_Status_Ghost, EGameplayTagEventType::NewOrRemoved); AbilitySystem->UnregisterGameplayTagEvent(GhostTagDelegateHandle, Tag_Status_Ghost, EGameplayTagEventType::NewOrRemoved);
AbilitySystem->UnregisterGameplayTagEvent(GhostTagDelegateHandle, Tag_Status_Invisible, EGameplayTagEventType::NewOrRemoved);
//---------------------------------------- //----------------------------------------
// Unregister to GameplayEffect events // Unregister to GameplayEffect events
@@ -687,6 +689,20 @@ void ACogSampleCharacter::OnGhostTagNewOrRemoved(const FGameplayTag InTag, int32
#endif //UE_WITH_CHEAT_MANAGER #endif //UE_WITH_CHEAT_MANAGER
} }
// ----------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::OnInvisibleTagNewOrRemoved(const FGameplayTag InTag, int32 NewCount)
{
#if UE_WITH_CHEAT_MANAGER
check(InTag == Tag_Status_Invisible);
bool bHasInvisibleTags = NewCount > 0;
SetActorHiddenInGame(bHasInvisibleTags);
#endif //UE_WITH_CHEAT_MANAGER
}
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::OnScaleAttributeChanged(const FOnAttributeChangeData& Data) void ACogSampleCharacter::OnScaleAttributeChanged(const FOnAttributeChangeData& Data)
{ {
+2
View File
@@ -338,6 +338,8 @@ protected:
void OnGhostTagNewOrRemoved(const FGameplayTag InTag, int32 NewCount); void OnGhostTagNewOrRemoved(const FGameplayTag InTag, int32 NewCount);
void OnInvisibleTagNewOrRemoved(const FGameplayTag InTag, int32 NewCount);
void OnScaleAttributeChanged(const FOnAttributeChangeData& Data); void OnScaleAttributeChanged(const FOnAttributeChangeData& Data);
void UpdateActiveAbilitySlots(); void UpdateActiveAbilitySlots();
@@ -39,6 +39,7 @@ UE_DEFINE_GAMEPLAY_TAG(Tag_GameplayCue_DamageReceived, "GameplayCue.DamageReceiv
UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Dead, "Status.Dead"); UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Dead, "Status.Dead");
UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Ghost, "Status.Ghost"); UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Ghost, "Status.Ghost");
UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Immobilized, "Status.Immobilized"); UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Immobilized, "Status.Immobilized");
UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Invisible, "Status.Invisible");
UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Immune_Damage, "Status.Immune.Damage"); UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Immune_Damage, "Status.Immune.Damage");
UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Revived, "Status.Revived"); UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Revived, "Status.Revived");
UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Silenced, "Status.Silenced"); UE_DEFINE_GAMEPLAY_TAG(Tag_Status_Silenced, "Status.Silenced");
@@ -42,6 +42,7 @@ UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Dead);
UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Ghost); UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Ghost);
UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Immobilized); UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Immobilized);
UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Immune_Damage); UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Immune_Damage);
UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Invisible);
UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_NoCooldown); UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_NoCooldown);
UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_NoCost); UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_NoCost);
UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Revived); UE_DECLARE_GAMEPLAY_TAG_EXTERN(Tag_Status_Revived);