Beispiel #1
0
        public static float DoDamage(AbilityUnitDamageType type, float value, Entity target)
        {
            //Debug.Log("DoDamage type=" + type+" value="+value+" target="+target.ToString());
            if (type == AbilityUnitDamageType.Magical && target.property.isMagicImmune)
            {
                value = 0;
            }
            var old = target.property.hp;

            target.property.hp -= value;
            var change   = old - target.property.hp;
            var listener = target.model as IPropertyListener;

            if (listener != null && change != 0)
            {
                listener.OnPropertyValueChanged();
            }
            return(change);
        }
Beispiel #2
0
 public DamageCommand(Damage damage)
 {
     m_DamageType  = damage.type;
     m_DamageValue = damage.value;
 }