public void Hurt(int h, Knight player) { Health -= h; if (Health == 0 && Animation.CurrentAnimation != "Death") { Animation.Play("Death"); FireballTimer.Stop(); AttackCooldown.Stop(); TeleportCooldown.Stop(); TeleportMove.Stop(); } }
public void FBHurt() { Health--; if (Health == 0 && Animation.CurrentAnimation != "Death") { Animation.Play("Death"); FireballTimer.Stop(); AttackCooldown.Stop(); TeleportCooldown.Stop(); TeleportMove.Stop(); } }
public override void _Process(float delta) { if (Health <= 0) { return; } var bs = Area.GetOverlappingBodies(); var a = new Node2D[bs.Count]; bs.CopyTo(a, 0); a = a.Where(b => b is Knight).ToArray(); if (TeleportCooldown.TimeLeft == 0) { if (a.Any()) { TeleportMove.Start(1f); TeleportCooldown.Start(4f); Animation.Play("Teleport"); AttackCooldown.Start(1.6f); } else if (GlobalPosition != Start) { TeleportMove.Start(1f); TeleportCooldown.Start(4f); Animation.Play("Teleport"); AttackCooldown.Start(1.6f); } } else { if (AttackCooldown.TimeLeft == 0) { TeleportCooldown.Start(3f); AttackCooldown.Start(3f); Animation.Play("Attack"); FireballTimer.Start(1f); } } }