forked from whztt07/UnityGameplayAbilitySystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAttribute.cs
More file actions
50 lines (39 loc) · 1.48 KB
/
Copy pathAttribute.cs
File metadata and controls
50 lines (39 loc) · 1.48 KB
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
using GameplayAbilitySystem.Attributes;
using GameplayAbilitySystem.Interfaces;
using UnityEngine;
namespace GameplayAbilitySystem {
/// <inheritdoc />
[AddComponentMenu("Ability System/Attributes/Attribute")]
[System.Serializable]
public class Attribute : IAttribute {
[SerializeField]
AttributeType _attributeType;
[SerializeField]
float _baseValue;
[SerializeField]
float _currentValue;
/// <inheritdoc />
public float BaseValue { get => _baseValue; }
/// <inheritdoc />
public float CurrentValue { get => _currentValue; }
/// <inheritdoc />
public AttributeType AttributeType { get => _attributeType; set => _attributeType = AttributeType; }
/// <inheritdoc />
public void SetAttributeCurrentValue(IAttributeSet AttributeSet, ref float NewValue) {
AttributeSet.PreAttributeChange(this, ref NewValue);
_currentValue = NewValue;
AttributeSet.AttributeCurrentValueChanged.Invoke(new AttributeChangeData()
{
Attribute = this
});
}
public void SetAttributeBaseValue(IAttributeSet AttributeSet, ref float NewValue) {
AttributeSet.PreAttributeBaseChange(this, ref NewValue);
_baseValue = NewValue;
AttributeSet.AttributeBaseValueChanged.Invoke(new AttributeChangeData()
{
Attribute = this
});
}
}
}