private void CacheAttribute() { if (this.att == null) { Component component = (this.attSource == ValueSource.Caller) ? base.owner : (this.attOwnerBind.GetValue() as Component); ICharacterAttributesOwner characterAttributesOwner = component as ICharacterAttributesOwner; if (characterAttributesOwner == null) { Debug.LogError("[Attribute Data Provider] The target object is not Attributes owner: " + (((object)component != null) ? component.gameObject.name : null), ((object)component != null) ? component.gameObject : null); } else { this.att = characterAttributesOwner.GetAttribute(this.attId); if (this.att == null) { string text = CharacterAttributeDefsAsset.Instance.IdToIdent(this.attId); Debug.LogErrorFormat("[Attribute Data Provider] Could not find Attribute [{0}] on [{1}]", text, ((object)component != null) ? component.gameObject.name : null, ((object)component != null) ? component.gameObject : null); } if (!base.isSetter) { if (this.attValType == ValueType.Value) { this.att.onValueChanged += this.BoundValueChanged; } else { this.att.onMaxValChanged += this.BoundValueChanged; } } } } }
public void Initialize(ICharacterAttributesOwner owner) { Component owner2 = (Component)owner; this.Value = this.def.initialValue; this.valueModifier = this.def.valueModifier.Copy(); this.valueModifier.Initialize(this.OnValueModifierChange, owner2); this.MaxValue = this.def.initialMaxVal; this.maxValModifier = this.def.maxValModifier.Copy(); this.valueModifier.Initialize(this.OnMaxValModifierChange, owner2); }