Пример #1
0
        /// <summary>
        /// クローンメソッド
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            var ret = new BaseEffect
            {
                FPS          = FPS,
                StartFrame   = StartFrame,
                currentframe = currentframe,
                FrameLength  = FrameLength,
                Filename     = Filename
            };

            if (CurrentState != null)
            {
                ret.CurrentState = (EffectStateStructure)CurrentState.Clone();
            }
            foreach (IEffect effect in Effects)
            {
                ret.Effects.Add((IEffect)effect.Clone());
            }
            EffectStateStructure state = null;

            foreach (KeyValuePair <int, EffectStateRatioSet> set in Sets)
            {
                var newset = (EffectStateRatioSet)set.Value.CloneExceptState();
                if (state != null)
                {
                    newset.StartState = state;
                }
                else
                {
                    newset.StartState = (EffectStateStructure)set.Value.StartState.Clone();
                }
                newset.EndState = (EffectStateStructure)set.Value.EndState.Clone();
                state           = newset.EndState;
                ret.Sets.Add(set.Key, newset);
            }
            return(ret);
        }