Esempio n. 1
0
        public override void ApplyToComponent <T>(T component)
        {
            var comp = component as RemoveStatusEffect;

            if (!string.IsNullOrEmpty(this.Status_Name))
            {
                this.SelectorValue = this.Status_Name;
            }
            else if (!string.IsNullOrEmpty(this.Status_Tag))
            {
                this.SelectorValue = this.Status_Tag;
            }

            comp.CleanseType = this.CleanseType;

            if (this.CleanseType == RemoveStatusEffect.RemoveTypes.StatusNameContains)
            {
                comp.StatusName = this.SelectorValue;
            }
            else if (this.CleanseType == RemoveStatusEffect.RemoveTypes.StatusSpecific)
            {
                var status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(this.SelectorValue);
                comp.StatusEffect = status;
            }
            else if (this.CleanseType == RemoveStatusEffect.RemoveTypes.StatusType)
            {
                var tag = CustomItems.GetTag(this.SelectorValue);
                if (tag != Tag.None)
                {
                    comp.StatusType = new TagSourceSelector(tag);
                }
            }
            else if (this.CleanseType == RemoveStatusEffect.RemoveTypes.StatusFamily)
            {
                var family = StatusEffectFamilyLibrary.Instance.GetStatusEffect(this.SelectorValue);
                if (family != null)
                {
                    comp.StatusFamily = new StatusEffectFamilySelector()
                    {
                        SelectorValue = family.UID,
                    };
                }
            }
        }