Esempio n. 1
0
        /// <inheritdoc />
        protected override void OnChildRemoved(Instance child)
        {
            base.OnChildRemoved(child);
            PostEffect  effect;
            ICameraUser cameraUser;

            if ((effect = child as PostEffect) != null)
            {
                lock (PostEffectsLocker)
                {
                    PostEffects.Remove(effect);
                    effect.SetCamera(null);

                    // replace user effect with default effect
                    if (effect is BloomEffect)
                    {
                        PostEffects.Add(_bloomEffect);
                    }
                    else if (effect is ColourCorrectionEffect)
                    {
                        PostEffects.Add(_colourCorrection);
                    }
                }
            }
            else if ((cameraUser = child as ICameraUser) != null)
            {
                cameraUser.Camera = null;
            }
        }
Esempio n. 2
0
        internal override void AfterDeserialization(Inst.Context context)
        {
            base.AfterDeserialization(context);

            lock (PostEffectsLocker)
            {
                foreach (var child in Children)
                {
                    var effect = child as PostEffect;
                    if (effect != null)
                    {
                        PostEffects.Add(effect);
                        effect.SetCamera(this);
                    }
                }
            }
        }