/// <summary>
        /// Reads the <see cref="ParticleModifier"/>'s custom values from the <see cref="reader"/>.
        /// </summary>
        /// <param name="reader"><see cref="IValueReader"/> to read the custom values from.</param>
        protected override void ReadCustomValues(IValueReader reader)
        {
            ModifyRed   = reader.ReadBool(_modifyRedKeyName);
            ModifyGreen = reader.ReadBool(_modifyGreenKeyName);
            ModifyBlue  = reader.ReadBool(_modifyBlueKeyName);
            ModifyAlpha = reader.ReadBool(_modifyAlphaKeyName);

            ReleaseColor  = reader.ReadColor(_releaseColorKeyName);
            UltimateColor = reader.ReadColor(_ultimateColorKeyName);
        }
示例#2
0
        /// <summary>
        /// Reads the <see cref="BackgroundImage"/> from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
        protected virtual void Read(IValueReader reader)
        {
            Name      = reader.ReadString(_valueKeyName);
            Alignment = reader.ReadEnum <Alignment>(_valueKeyAlignment);
            Color     = reader.ReadColor(_valueKeyColor);
            Depth     = reader.ReadFloat(_valueKeyDepth);
            Offset    = reader.ReadVector2(_valueKeyOffset);
            var grhIndex = reader.ReadGrhIndex(_valueKeyGrhIndex);

            _sprite = new Grh(grhIndex, AnimType.Loop, Map.GetTime());
        }
示例#3
0
        void LoadLighting(IValueReader reader)
        {
            reader = reader.ReadNode(_lightingNodeName);

            AmbientLight = reader.ReadColor("Ambient");

            var loadedLights = reader.ReadManyNodes(_lightsNodeName, x => new Light(x));

            _lights.AddRange(loadedLights);

            foreach (var light in loadedLights)
            {
                light.Tag = this;
            }
        }
示例#4
0
        /// <summary>
        /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact
        /// same order as they were written.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param>
        public void ReadState(IValueReader reader)
        {
            PositionProvider = null;
            Tag = null;

            Position  = reader.ReadVector2(_positionValueKey);
            Size      = reader.ReadVector2(_sizeValueKey);
            Color     = reader.ReadColor(_colorValueKey);
            Rotation  = reader.ReadFloat(_rotationValueKey);
            IsEnabled = reader.ReadBool(_isEnabledValueKey);

            var grhIndex = reader.ReadGrhIndex(_spriteValueKey);

            if (grhIndex.IsInvalid)
            {
                Sprite = new Grh(grhIndex, AnimType.Loop, 0);
            }
            else
            {
                Sprite = null;
            }
        }
示例#5
0
        void LoadLighting(IValueReader reader)
        {
            reader = reader.ReadNode(_lightingNodeName);

            AmbientLight = reader.ReadColor("Ambient");

            _lights.Clear();

            var loadedLights = reader.ReadManyNodes(_lightsNodeName, x => new Light(x));
            _lights.AddRange(loadedLights);

            foreach (var light in loadedLights)
            {
                light.Tag = this;
            }
        }
示例#6
0
        /// <summary>
        /// Reads the <see cref="ParticleModifier"/>'s custom values from the <see cref="reader"/>.
        /// </summary>
        /// <param name="reader"><see cref="IValueReader"/> to read the custom values from.</param>
        protected override void ReadCustomValues(IValueReader reader)
        {
            ModifyRed = reader.ReadBool(_modifyRedKeyName);
            ModifyGreen = reader.ReadBool(_modifyGreenKeyName);
            ModifyBlue = reader.ReadBool(_modifyBlueKeyName);
            ModifyAlpha = reader.ReadBool(_modifyAlphaKeyName);

            ReleaseColor = reader.ReadColor(_releaseColorKeyName);
            UltimateColor = reader.ReadColor(_ultimateColorKeyName);
        }
 /// <summary>
 /// When overridden in the derived class, reads a value with the specified name from an IValueReader.
 /// </summary>
 /// <param name="name">Name of the value.</param>
 /// <param name="reader">IValueReader to read from.</param>
 /// <returns>Value read from the IValueReader.</returns>
 protected override Color Read(string name, IValueReader reader)
 {
     return(reader.ReadColor(name));
 }
示例#8
0
        /// <summary>
        /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact
        /// same order as they were written.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param>
        public void ReadState(IValueReader reader)
        {
            PositionProvider = null;
            Tag = null;

            Position = reader.ReadVector2(_positionValueKey);
            Size = reader.ReadVector2(_sizeValueKey);
            Color = reader.ReadColor(_colorValueKey);
            Rotation = reader.ReadFloat(_rotationValueKey);
            IsEnabled = reader.ReadBool(_isEnabledValueKey);

            var grhIndex = reader.ReadGrhIndex(_spriteValueKey);
            if (!grhIndex.IsInvalid)
                Sprite = new Grh(grhIndex, AnimType.Loop, 0);
            else
                Sprite = null;
        }
示例#9
0
        /// <summary>
        /// Reads the <see cref="BackgroundImage"/> from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
        protected virtual void Read(IValueReader reader)
        {
            Name = reader.ReadString(_valueKeyName);
            Alignment = reader.ReadEnum<Alignment>(_valueKeyAlignment);
            Color = reader.ReadColor(_valueKeyColor);
            Depth = reader.ReadFloat(_valueKeyDepth);
            Offset = reader.ReadVector2(_valueKeyOffset);
            var grhIndex = reader.ReadGrhIndex(_valueKeyGrhIndex);

            _sprite = new Grh(grhIndex, AnimType.Loop, Map.GetTime());
        }