protected override void Start()
        {
            base.Start();
            Health = GetComponent <HealthProperty>();

            type = ObjectType.Mob;
        }
Beispiel #2
0
 public void TakeDamage()
 {
     HealthProperty.Value -= _Damage; // take damage
     HealthProperty.ClampValue();
     if (HealthProperty.Value <= 0)
     {
         Death();
     }
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 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) },
     });
 }
Beispiel #5
0
this.SetValue(HealthProperty, value);