Exemplo n.º 1
0
        private async Task <GeneratePathResult> GeneratePath(Vector3 start, Vector3 end)
        {
            CurrentPath = new FlightPath(start, end, flightNavigationArgs);

            FlightPath path;

            if (FlightPath.Paths.TryGetValue(CurrentPath.Key, out path))
            {
                CurrentPath = path;

                return(GeneratePathResult.SuccessUseExisting);
            }

            if (await CurrentPath.BuildPath())
            {
                if (CurrentPath.Count > 0)
                {
                    FlightPath.Paths[CurrentPath.Key] = CurrentPath;

                    return(GeneratePathResult.Success);
                }
            }

            logger.Error(
                Localization.Localization.FlightEnabledNavigator_NoPath);
            Clear();

            return(GeneratePathResult.Success);
        }
Exemplo n.º 2
0
        public FlightEnabledNavigator(
            NavigationProvider innerNavigator,
            IFlightEnabledPlayerMover playerMover,
            IFlightNavigationArgs flightNavigationArgs) : base(innerNavigator)
        {
            logger                       = new Logger(new FlightEnabledNavigatorLogColors(), "FlightNav");
            this.playerMover             = playerMover;
            this.flightNavigationArgs    = flightNavigationArgs;
            Navigator.NavigationProvider = this;
            CurrentPath                  = new FlightPath(Vector3.Zero, Vector3.Zero, flightNavigationArgs);

            logger.Verbose(Localization.Localization.FlightEnabledNavigator_Enabled);
        }
Exemplo n.º 3
0
        private async Task <GeneratePathResult> GeneratePath(Vector3 start, Vector3 end)
        {
            CurrentPath = new FlightPath(start, end, flightNavigationArgs);

            FlightPath path;

            if (FlightPath.Paths.TryGetValue(CurrentPath.Key, out path))
            {
                CurrentPath = path;

                return(GeneratePathResult.SuccessUseExisting);
            }

            if (await CurrentPath.BuildPath())
            {
                if (CurrentPath.Count > 0)
                {
                    FlightPath.Paths[CurrentPath.Key] = CurrentPath;

                    return(GeneratePathResult.Success);
                }
            }

            logger.Error(
                Localization.Localization.FlightEnabledNavigator_NoPath);
            Clear();

            Navigator.NavigationProvider = innerNavigator;
#pragma warning disable 4014
            Task.Factory.StartNew(
#pragma warning restore 4014
                () =>
            {
                Thread.Sleep(10000);
                logger.Info(Localization.Localization.FlightEnabledNavigator_ResetNavigatonProvider);
                Navigator.NavigationProvider = this;
            });

            return(GeneratePathResult.Failed);
        }
Exemplo n.º 4
0
 public static Guid GetKey(FlightPath flightPath)
 {
     return(flightPath.Key);
 }
Exemplo n.º 5
0
 public bool Equals(FlightPath other)
 {
     return(Equals(other.Start, other.End, other.flightNavigationArgs));
 }