public override IEnumerable <Action <GameTime> > Action(Game game, IServiceProvider provider)
        {
            var transform = provider.GetService <Transform2D>();
            var vehicle   = provider.GetService <Vehicle>();

            bool arrived = false;
            var  arrival = Steering.Arrival(transform, vehicle, MinSpeed, MaxSpeed, Tolerance);

            while (!arrived)
            {
                yield return(gameTime =>
                {
                    arrival(gameTime);
                    if (vehicle.Steering.Length() <= Tolerance)
                    {
                        arrived = true;
                    }
                });
            }
        }
Exemple #2
0
 private Vector3 Cohesion()
 {
     return(steering.Arrival(gameManager.Mayor.transform.position));
 }