internal static bool retreat(this Enemy ths, List <Sprite> targets, float safeDistance, float speedMultiplier) { return(ths.retreat(targets, TimeSpan.MaxValue, safeDistance, speedMultiplier)); }
/// <summary> /// Be Invisible and move away until you are y distance away /// </summary> internal static bool stealthRetreat(this Enemy ths, List <Sprite> targets, float safeDistance, float speedMultiplier) { ths.Visible = ths.retreat(targets, safeDistance, speedMultiplier); return(ths.Visible); }
public static IEnumerable<bool> RetreatingAttack(Sprite target, Enemy attacker, float distance, TimeSpan duration, IEnumerable<bool> attack) { FrostbyteLevel l = This.Game.CurrentLevel as FrostbyteLevel; attacker.State = SpriteState.Attacking; attacker.isAttackAnimDone = false; List<Sprite> targets = new List<Sprite>(); targets.Add(target); TimeSpan endRetreat = This.gameTime.TotalGameTime + duration; attacker.Personality.Status = EnemyStatus.Wander; while (true) { attacker.previousFootPos = attacker.GroundPos; if (attacker.retreat(targets, distance, 5) || endRetreat < This.gameTime.TotalGameTime) { break; } attacker.checkBackgroundCollisions(); yield return false; } foreach(bool o in attack) { yield return false; } attacker.isAttackAnimDone = true; yield return true; }