public override void SerializeItem(Item item)
        {
            base.SerializeItem(item);

            var skill = item as CounterAbsorbSkill;

            var list = new List <AbsorbType>();

            foreach (var absorb in skill.Absorbs)
            {
                list.Add(new AbsorbType()
                {
                    Condition   = absorb.Condition != null ? (SL_BooleanCondition)SL_EffectCondition.ParseCondition(absorb.Condition) : null,
                    DamageTypes = absorb.Types
                });
            }
            Absorbs = list.ToArray();
        }
Ejemplo n.º 2
0
        public static SL_EffectTransform ParseTransform(Transform transform)
        {
            var holder = new SL_EffectTransform
            {
                TransformName = transform.name
            };

            if (transform.localPosition != Vector3.zero)
            {
                holder.Position = transform.localPosition;
            }
            if (transform.localEulerAngles != Vector3.zero)
            {
                holder.Rotation = transform.localEulerAngles;
            }
            if (transform.localScale != Vector3.one)
            {
                holder.Scale = transform.localScale;
            }

            var slEffects = new List <SL_Effect>();

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

                if (SL_Effect.ParseEffect(effect) is SL_Effect slEffect)
                {
                    slEffects.Add(slEffect);
                }
            }
            holder.Effects = slEffects.ToArray();

            var slConditions = new List <SL_EffectCondition>();

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

                if (SL_EffectCondition.ParseCondition(condition) is SL_EffectCondition slCondition)
                {
                    slConditions.Add(slCondition);
                }
            }
            holder.EffectConditions = slConditions.ToArray();

            var children = new List <SL_EffectTransform>();

            foreach (Transform child in transform)
            {
                if (child.name == "ExplosionFX" || child.name == "ProjectileFX")
                {
                    continue;
                }

                var transformHolder = ParseTransform(child);

                if (transformHolder.HasContent)
                {
                    children.Add(transformHolder);
                }
            }
            holder.ChildEffects = children.ToArray();

            return(holder);
        }