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; }
internal AmbushPersonality(Enemy master) { this.master = master; mStates = States().GetEnumerator(); }
public static IEnumerable<bool> RammingAttack(Sprite target, Enemy attacker, int baseDamage, TimeSpan duration, Element elem = Element.None) { FrostbyteLevel l = This.Game.CurrentLevel as FrostbyteLevel; attacker.State = SpriteState.Attacking; attacker.isAttackAnimDone = false; List<Sprite> targets = new List<Sprite>(); targets.Add(target); int dmgcount = 0; attacker.Personality.Status = EnemyStatus.Wander; while (true) { attacker.previousFootPos = attacker.GroundPos; if (attacker.ram(targets, duration, float.PositiveInfinity, 20)) { break; } attacker.checkBackgroundCollisions(); if (dmgcount++ % 10 == 0 && Collision.CollisionData.Count > 0) { List<Tuple<CollisionObject, WorldObject, CollisionObject>> collidedWith; Collision.CollisionData.TryGetValue(attacker, out collidedWith); if (collidedWith != null) { foreach (Tuple<CollisionObject, WorldObject, CollisionObject> detectedCollision in collidedWith) { if (detectedCollision.Item2 is Player && attacker is Enemy) { Damage(attacker, (detectedCollision.Item2 as OurSprite), baseDamage); } } } } yield return false; } attacker.isAttackAnimDone = true; yield return true; }
internal DartWanderPersonality(Enemy master) { this.master = master; mStates = States().GetEnumerator(); }
internal WanderingMinstrelPersonality(Enemy master) { this.master = master; mStates = States().GetEnumerator(); }
internal WalkingSentinelPersonality(Enemy master) { this.master = master; mStates = States().GetEnumerator(); }
internal SwoopingPersonality(Enemy master) { this.master = master; mStates = States().GetEnumerator(); }
internal PulseChargePersonality(Enemy master) { this.master = master; mStates = States().GetEnumerator(); }