public IEnumerable States() { List <Sprite> targets = (This.Game.CurrentLevel as FrostbyteLevel).allies; Vector2 guardPosition = master.GroundPos; while (true) { Sprite closestTarget = master.GetClosestTarget(targets, 550.0f); if (closestTarget != null && Vector2.DistanceSquared(closestTarget.GroundPos, master.GroundPos) > 100 * 100) { master.charge(closestTarget.GroundPos, 1.3f); } else if (closestTarget == null && Vector2.DistanceSquared(guardPosition, master.GroundPos) > 20 * 20) { master.charge(guardPosition, 3.0f); } else if (closestTarget == null && Vector2.DistanceSquared(guardPosition, master.GroundPos) <= 20 * 20) { Sprite closestTarget2 = master.GetClosestTarget(targets, 800.0f); master.State = SpriteState.Idle; if (closestTarget2 != null) { master.Direction = closestTarget2.GroundPos - master.GroundPos; } } yield return(null); } }
public IEnumerable States() { List <Sprite> targets = (This.Game.CurrentLevel as FrostbyteLevel).allies; float[] distances = new float[3] { 1000f, 150f, 100f }; while (true) { while (!master.stealthCharge(targets, TimeSpan.MaxValue, distances[1], distances[0], 1f)) { yield return(null); } while (!master.stealthCamp(targets, distances[2], distances[1])) { yield return(null); } while (!master.charge(targets, distances[2], 2)) { yield return(null); } yield return(null); } }
public IEnumerable States() { List <Sprite> targets = (This.Game.CurrentLevel as FrostbyteLevel).allies; while (true) { master.charge(targets, 500, 3.3f); yield return(null); } }
/// <summary> /// Update enemy position directly toward target with variation of speed (sinusoidal) for given duration - complete /// </summary> internal static bool pulseCharge(this Enemy ths, List <Sprite> targets, float aggroDistance, float speedMultiplier) { speedMultiplier = 2 * (float)Math.Sin((2 * This.gameTime.TotalGameTime.Milliseconds / 1000.0) * (2 * Math.PI)) + 3.5f; return(ths.charge(targets, aggroDistance, speedMultiplier)); }