public void TakeDamage(IDamageBehavior damageBehavior, Character source) { Health.Use(damageBehavior.Damage); if (Health.Current <= 0) { Killed(this, source); } }
private void Init() { Acceleration = 5; Angle = Source.Target != null ? (int)GameWorld.CalcAngle(Source.Location.ToPoint(), Source.Target.Location.ToPoint()) : Source.Angle; Cost = 20; Damage = 200; DamageBehavior = new NormalDamageBehavior(Source, Source.Targets, (int)Damage); DrawBehavior = new TopDownRotationDrawBehavior(this); Inertia = new DecimalPoint(5, 5); ActualSpeed = Source.ActualSpeed; Location = new DecimalPoint(Source.Location.X, Source.Location.Y); MotionBehavior = new NormalMotionBehavior(this, GameWorld); Paralax = Paralax.Middleground; TargetSpeed = 20; IsPhysicalObject = false; MotionBehavior.CanMoveThroughObjects = true; SpellHandler = Source.SpellHandler; SpellHandler.Spells.Add(this); AttackBehaviors = new List <IAttackBehavior>(); GameWorld.Collision += GameWorld_Collision; GameWorld.Split += GameWorld_Split; }
void Start() { _damageBehavior = GetComponent<IDamageBehavior>(); }
void Start() { _damageBehavior = GetComponent <IDamageBehavior>(); }
public void TakeDamage(IDamageBehavior damageBehavior, Character source) { Health.Use(damageBehavior.Damage); if (Health.Current <= 0) Killed(this, source); }