protected override void Start() { base.Start(); Health = GetComponent <HealthProperty>(); type = ObjectType.Mob; }
public void TakeDamage() { HealthProperty.Value -= _Damage; // take damage HealthProperty.ClampValue(); if (HealthProperty.Value <= 0) { Death(); } }
private void SetupProperties(int defense, bool meleAttackDestructible, bool magicAttackDestructible) { var health = new HealthProperty(defense); var antiMele = new DefenseProperty(meleAttackDestructible ? 0 : 1000000); //TODO thinkout var antiMagic = new AntiMagicProperty(magicAttackDestructible ? 0 : 1000000); //TODO thinkout properties.Add(health.Type, health); properties.Add(antiMele.Type, antiMele); properties.Add(antiMagic.Type, antiMagic); }
private Dictionary <IPropertyFactory, IProperty> InitProperties(int hitPoints, out HealthProperty health) { return(new Dictionary <IPropertyFactory, IProperty> { { PropertyFactory <HealthProperty> .Instance, health = new HealthProperty(hitPoints) }, { PropertyFactory <ExperienceProperty> .Instance, new ExperienceProperty(Factory.Experience) }, { PropertyFactory <DefenseProperty> .Instance, new DefenseProperty(Factory.Defense) }, { PropertyFactory <DextrityProperty> .Instance, new DextrityProperty(Factory.Dexterity) }, { PropertyFactory <AntiFireProperty> .Instance, new DextrityProperty(Factory.FireResistance) }, { PropertyFactory <AntiPoisonProperty> .Instance, new DextrityProperty(Factory.PoisonResistance) }, }); }
this.SetValue(HealthProperty, value);