using System; using EPOOutline; using PixelCrushers.QuestMachine; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Beyond { public class GuiltOnScrollPickSetter : MonoBehaviour { public bTriggerGenericAction triggerAction; public Quest guilt; public int maturityToSafePickup = 0; public Color lowMaturityColor, enoughMaturityColor; private QuestObject questObject; private void Awake() { questObject = GetComponentInChildren(); PlayerAttribute maturity = Player.Instance.MaturityAttribute; TryToSetGuilt(maturity.AttributeCurrentValue, 0); maturity.OnValueChanged.AddListener(TryToSetGuilt); } private void OnDestroy() { if (Player.Instance) { PlayerAttribute maturity = Player.Instance.MaturityAttribute; maturity.OnValueChanged.RemoveListener(TryToSetGuilt); } } public void TryToSetGuilt(float newVal, float oldVal) { if (newVal < maturityToSafePickup) { triggerAction.m_guilt = guilt; questObject.m_fresnelColor = lowMaturityColor; } else { triggerAction.m_guilt = null; questObject.m_fresnelColor = enoughMaturityColor; } } } }