private void pathFollowingToolStripMenuItem_Click(object sender, EventArgs e) { var world = GameWorld.Instance; foreach (var entity in world.Entities) { if (pathFollowingToolStripMenuItem.Checked) { Location goal = new Location(world.Random.Next(5, (int)world.Width - 5), world.Random.Next(5, (int)world.Height - 5)); BaseSteering behaviour; if (Settings.Instance.UseTimeSlicedNavigation) { behaviour = new PathFollowingTimeSliced(goal); } else { behaviour = new PathFollowing(goal); } entity.AddBehaviour(behaviour); } else { if (Settings.Instance.UseTimeSlicedNavigation) { entity.RemoveBehaviour(typeof(PathFollowingTimeSliced)); } else { entity.RemoveBehaviour(typeof(PathFollowing)); } } } }
public PathPlanner(PathFollowingTimeSliced reference) { Reference = reference; }