Beispiel #1
0
        public override void SerializeItem(Item item, DM_Item holder)
        {
            base.SerializeItem(item, holder);

            var skill    = item as CounterAbsorbSkill;
            var template = holder as DM_CounterAbsorbSkill;

            template.Absorbs = new List <AbsorbType>();
            foreach (var absorb in skill.Absorbs)
            {
                template.Absorbs.Add(new AbsorbType()
                {
                    Condition   = absorb.Condition != null ? (DM_BooleanCondition)DM_EffectCondition.ParseCondition(absorb.Condition) : null,
                    DamageTypes = absorb.Types
                });
            }
        }
        public static DM_EffectTransform ParseTransform(Transform transform)
        {
            var effectTransformHolder = new DM_EffectTransform
            {
                TransformName = transform.name
            };

            foreach (Effect effect in transform.GetComponents<Effect>())
            {
                if (!effect.enabled)
                {
                    continue;
                }

                if (DM_Effect.ParseEffect(effect) is DM_Effect holder)
                {
                    effectTransformHolder.Effects.Add(holder);
                }
            }

            foreach (EffectCondition condition in transform.GetComponents<EffectCondition>())
            {
                var effectConditionHolder = DM_EffectCondition.ParseCondition(condition);
                effectTransformHolder.EffectConditions.Add(effectConditionHolder);
            }

            foreach (Transform child in transform)
            {
                if (child.name == "ExplosionFX" || child.name == "ProjectileFX")
                {
                    // visual effects, we dont care about these
                    continue;
                }

                var transformHolder = ParseTransform(child);
                if (transformHolder.ChildEffects.Count > 0 || transformHolder.Effects.Count > 0 || transformHolder.EffectConditions.Count > 0)
                {
                    effectTransformHolder.ChildEffects.Add(transformHolder);
                }
            }

            return effectTransformHolder;
        }