Skip to content

Commit

Permalink
fix: tooltip not working in some class
Browse files Browse the repository at this point in the history
* Also remove serializable on NullAbilityContext to prevent error
and because its not necessary
  • Loading branch information
h2v9696 committed Sep 23, 2024
1 parent 54f8b80 commit c73693a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 27 deletions.
1 change: 0 additions & 1 deletion Runtime/AbilitySystem/AbilityContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public interface IAbilityContext
bool IsValid { get; }
}

[Serializable]
public class NullAbilityContext : IAbilityContext
{
public static NullAbilityContext Instance { get; } = new NullAbilityContext();
Expand Down
12 changes: 6 additions & 6 deletions Runtime/AbilitySystem/ScriptableObjects/AbilitySO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public abstract class AbilitySO : ScriptableObject, IAbilityCreator<AbilitySpec>
{
[field: SerializeField] public AbilityTags Tags { get; private set; } = new();

[Tooltip("Context of ability such as paramaters, effect, etc. Only one of each type is allowed.")]
[field: SerializeReference, SubclassSelector] public IAbilityContext[] Contexts
{ get; private set; } = Array.Empty<IAbilityContext>();
[field: SerializeReference, SubclassSelector,
Tooltip("Context of ability such as paramaters, effect, etc. Only one of each type is allowed.")]
public IAbilityContext[] Contexts { get; private set; } = Array.Empty<IAbilityContext>();

[Tooltip("Custom condition to active ability.")]
[field: SerializeReference, SubclassSelector] public IAbilityCondition[] Conditions
{ get; private set; } = Array.Empty<IAbilityCondition>();
[field: SerializeReference, SubclassSelector,
Tooltip("Custom condition to active ability.")]
public IAbilityCondition[] Conditions { get; private set; } = Array.Empty<IAbilityCondition>();

public TContext GetContext<TContext>() where TContext : IAbilityContext
{
Expand Down
8 changes: 4 additions & 4 deletions Runtime/AttributeSystem/AttributeValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public enum EModifierType
public struct AttributeValue
{
[field: SerializeField] public AttributeSO Attribute { get; set; }
[Tooltip("This is permanent value, from stats, gear, etc.")]
[field: SerializeField] public float BaseValue { get; set; }
[Tooltip("This is temporary value, modify from effects and might be removed")]
[field: SerializeField] public float CurrentValue { get; set; }
[field: SerializeField, Tooltip("This is permanent value, from stats, gear, etc.")]
public float BaseValue { get; set; }
[field: SerializeField, Tooltip("This is temporary value, modify from effects and might be removed")]
public float CurrentValue { get; set; }

/// <summary>
/// Sum of all external effects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public delegate void PostAttributeChangeDelegate(AttributeSO attribute, Attribut

[SerializeField] private bool _initOnAwake = true;

[Tooltip("Event for any logic pre and post attribute change")]
[SerializeField] private List<AttributesEventBase> _attributeEvents = new();
[SerializeField, Tooltip("Event for any logic pre and post attribute change")]
private List<AttributesEventBase> _attributeEvents = new();

[Tooltip("You can add attribute here for default attribute")]
[SerializeField] private List<AttributeSO> _attributes = new();
[SerializeField, Tooltip("You can add attribute here for default attribute")]
private List<AttributeSO> _attributes = new();
public List<AttributeSO> Attributes => _attributes;

[SerializeField] private List<AttributeValue> _attributeValues = new();
Expand Down
8 changes: 4 additions & 4 deletions Runtime/AttributeSystem/ScriptableObjects/AttributeSO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ namespace H2V.GameplayAbilitySystem.AttributeSystem.ScriptableObjects
[CreateAssetMenu(menuName = "H2V/Gameplay Ability System/Attributes/Attribute")]
public class AttributeSO : SerializableScriptableObject
{
[Tooltip("This is calculator run when calculate init attribute value.")]
[field: SerializeReference, SubclassSelector]
[field: SerializeReference, SubclassSelector,
Tooltip("This is calculator run when calculate init attribute value.")]
public IAttributeValueCalculator InitialValueCalculator { get; private set; }
= new InitialAttributeValueCalculator();

[Tooltip("This is calculator run when calculate current attribute value.")]
[field: SerializeReference, SubclassSelector]
[field: SerializeReference, SubclassSelector,
Tooltip("This is calculator run when calculate current attribute value.")]
public IAttributeValueCalculator CurrentValueCalculator { get; private set; }
= new CurrentAttributeValueCalculator();
}
Expand Down
4 changes: 2 additions & 2 deletions Runtime/EffectSystem/EffectConditions/ChanceToApply.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace H2V.GameplayAbilitySystem.EffectSystem.EffectConditions
[Serializable]
public class ChanceToApply : IEffectCondition
{
[SerializeField, Range(0f, 1f)]
[Tooltip("There {ChanceToApply}*100% chance that effect will be applied")]
[SerializeField, Range(0f, 1f),
Tooltip("There {ChanceToApply}*100% chance that effect will be applied")]
private float _chance = 1f;

public bool IsPass(GameplayEffectSpec effectSpec)
Expand Down
8 changes: 4 additions & 4 deletions Runtime/EffectSystem/GamplayEffectPolicies/PeriodicPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ namespace H2V.GameplayAbilitySystem.EffectSystem.GamplayEffectPolicies
[Serializable]
public class PeriodicPolicy : StackPolicy
{
[Tooltip("Duration of the effect")]
[field: SerializeField] public int ActiveTimes { get; private set; }
[field: SerializeField, Tooltip("Duration of the effect")]
public int ActiveTimes { get; private set; }

[Tooltip("Interval of the effect")]
[field: SerializeField] public float Interval { get; private set; }
[field: SerializeField, Tooltip("Interval of the effect")]
public float Interval { get; private set; }

[field: SerializeField] public bool IsResetOnStackChange { get; private set; }

Expand Down
3 changes: 1 addition & 2 deletions Runtime/EffectSystem/ScriptableObjects/GameplayEffectSO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public class GameplayEffectSO : ScriptableObject, IGameplayEffectDef
[field: SerializeField, TextArea(0, 3)]
public string Description { get; private set; }

[field: SerializeField]
[Tooltip("Tag to define this effect")]
[field: SerializeField, Tooltip("Tag to define this effect")]
public TagSO EffectTag { get; private set; }

/// <summary>
Expand Down

0 comments on commit c73693a

Please sign in to comment.