Beispiel #1
0
        /// <summary>
        ///     Attempts to set the damage value for the given <see cref="DamageType"/>.
        /// </summary>
        /// <returns>
        ///     True if successful, false if this container does not support that type.
        /// </returns>
        public bool TrySetDamageValue(DamageType type, int newValue)
        {
            if (newValue < 0)
            {
                return(false);
            }

            var damageClass = type.ToClass();

            if (SupportedClasses.Contains(damageClass))
            {
                var old = _damageList[type] = newValue;
                _damageList[type] = newValue;

                var delta = newValue - old;
                var datum = new HealthChangeData(type, newValue, delta);
                var data  = new List <HealthChangeData> {
                    datum
                };

                OnHealthChanged(data);

                return(true);
            }

            return(false);
        }
Beispiel #2
0
 public bool SupportsDamageType(DamageType type)
 {
     return(SupportedClasses.Contains(type.ToClass()));
 }
Beispiel #3
0
 public bool SupportsDamageClass(DamageClass @class)
 {
     return(SupportedClasses.Contains(@class));
 }