Пример #1
0
 private static void VillagerEndPath(object sender, UnitEndPathEventArgs args)
 {
     IHubContext hubContext = GlobalHost.ConnectionManager.GetHubContext<EvolutionHub>();
     hubContext.Clients.All.unitEndPath(args.Unit.Id, args.Location, args.PathInterrupted);
 }
Пример #2
0
        /// <summary>
        /// Resets the Destination and RemainingRoute. Sends the OnEndPath event.
        /// </summary>
        /// <param name="interrupted">false - if the destination has been reached, true - otherwise.</param>
        protected void RouteEnded(bool interrupted)
        {
            Destination = null;
            RemainingRoute = null;

            Logging.LogUnit(Id, string.Format("Path interrupted at (x:{0}, y:{1})", Location.X, Location.Y));

            if (OnEndPath != null)
            {
                UnitEndPathEventArgs args = new UnitEndPathEventArgs
                {
                    Unit = this,
                    Location = Location,
                    //Destination is set to null in EndMove if it is reached
                    PathInterrupted = interrupted
                };
                OnEndPath(this, args);
            }
        }