public override void Apply(Prop ch, Character caster = null) { if (!delays.ContainsKey(ch) || delays[ch] < Time.time) { if (!explosion) { Debug.Log("Explosion " + name + "has no PowerArea"); return; } if (explosion.userFX) { GameObject go = explosion.userFX.Begin(ch.GetBodyPart(explosion.userBodyPart), explosion.tint); explosion.userFX.ScaleToRadius(go, explosion.GetRadius(caster)); } explosion.Explode(ch.transform, caster); delays[ch] = Time.time + 0.4f; } }
public virtual void ApplyDamage(float damage, RPGSettings.DamageType dt) { if (dead) { return; } // apply damage resistance if (dt != RPGSettings.DamageType.Healing) { damage *= GetFactor(-stats[RPGSettings.GetResistanceStat(dt)].currentValue); } health -= damage; if (health <= 0) { // die! if (explosion) { explosion.Explode(GetBodyPart(Character.BodyPart.Chest), null); } dead = true; RPGSettings.instance.RemoveCharacter(this); foreach (Character ch in Power.getAll()) { if (ch.target == this) { ch.target = null; } } OnDeath(); } int dmg = (int)Mathf.Abs(damage); NumberFloat(dmg.ToString(), damage > 0 ? Color.red : Color.green); // TODO if we don't have a HUD yet, add a healthbar to props? RPGSettings.instance.SetupCharacter(this); }