Ejemplo n.º 1
0
        public override void ExposeData(ObjectSerializer serializer)
        {
            base.ExposeData(serializer);

            // TODO: Writing
            if (serializer.Reading)
            {
                DamageType damageType  = DamageType.Total;
                int        damageValue = 0;

                serializer.DataReadFunction("thresholdtype", DamageType.Total, type => damageType = type);
                serializer.DataReadFunction("thresholdvalue", 0, val => damageValue = val);

                Threshold = new DamageThreshold(damageType, damageValue, ThresholdType.Destruction);
            }
        }
        /// <inheritdoc />
        public override void LoadParameters(YamlMappingNode mapping)
        {
            //TODO currently only supports one threshold pair; gotta figure out YAML better

            YamlNode node;

            DamageType damageType  = DamageType.Total;
            int        damageValue = 0;

            if (mapping.TryGetNode("thresholdtype", out node))
            {
                damageType = node.AsEnum <DamageType>();
            }
            if (mapping.TryGetNode("thresholdvalue", out node))
            {
                damageValue = node.AsInt();
            }

            Threshold = new DamageThreshold(damageType, damageValue);
        }
Ejemplo n.º 3
0
 public DamageThresholdPassedEventArgs(DamageThreshold threshold, bool passed, int excess)
 {
     DamageThreshold = threshold;
     Passed          = passed;
     ExcessDamage    = excess;
 }
Ejemplo n.º 4
0
 public DamageThresholdPassedEventArgs(DamageThreshold threshold, bool passed)
 {
     DamageThreshold = threshold;
     Passed          = passed;
 }