コード例 #1
0
 /// <summary>
 /// Will find and move to Prioritized Scene's based on Scene SNOId or Name
 /// </summary>
 /// <returns></returns>
 private Composite PrioritySceneCheck()
 {
     return
         (new Decorator(ret => !(SceneId == 0 && String.IsNullOrEmpty(SceneName.Trim())),
                        new Sequence(
                            new DecoratorContinue(ret => DateTime.Now.Subtract(lastCheckedScenes).TotalMilliseconds > 1000,
                                                  new Sequence(
                                                      new Action(ret => lastCheckedScenes = DateTime.Now),
                                                      new Action(ret => FindPrioritySceneTarget())
                                                      )
                                                  ),
                            new Decorator(ret => PrioritySceneTarget != Vector3.Zero,
                                          new PrioritySelector(
                                              new Decorator(ret => PrioritySceneTarget.Distance2D(myPos) <= PathPrecision,
                                                            new Sequence(
                                                                new Action(ret => Logger.DBLog.DebugFormat("Successfully navigated to priority scene {0} {1} center {2} Distance {3:0}",
                                                                                                           CurrentPriorityScene.Name, CurrentPriorityScene.SceneInfo.SNOId, PrioritySceneTarget, PrioritySceneTarget.Distance2D(myPos))),
                                                                new Action(ret => isDone = true)
                                                                )
                                                            ),
                                              new Action(ret => MoveToPriorityScene())
                                              )
                                          )
                            )
                        ));
 }
コード例 #2
0
        /// <summary>
        /// Handles actual movement to the Priority Scene
        /// </summary>
        private void MoveToPriorityScene()
        {
            Logger.DBLog.DebugFormat("Moving to Priority Scene {0} - {1} Center {2} Distance {3:0}",
                                     CurrentPriorityScene.Name, CurrentPriorityScene.SceneInfo.SNOId, PrioritySceneTarget, PrioritySceneTarget.Distance2D(myPos));

            var moveResult = Funky.PlayerMover.NavigateTo(PrioritySceneTarget);

            if (moveResult == MoveResult.PathGenerationFailed)
            {
                Logger.DBLog.DebugFormat("Unable to navigate to Scene {0} - {1} Center {2} Distance {3:0}, cancelling!",
                                         CurrentPriorityScene.Name, CurrentPriorityScene.SceneInfo.SNOId, PrioritySceneTarget, PrioritySceneTarget.Distance2D(myPos));
                PrioritySceneMoveToFinished();
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles actual movement to the Priority Scene
        /// </summary>
        private void MoveToPriorityScene()
        {
            DbHelper.Log(TrinityLogLevel.Normal, LogCategory.ProfileTag, "Moving to Priority Scene {0} - {1} Center {2} Distance {3:0}",
                         CurrentPriorityScene.Name, CurrentPriorityScene.SceneInfo.SNOId, PrioritySceneTarget, PrioritySceneTarget.Distance2D(myPos));

            MoveResult moveResult = PlayerMover.NavigateTo(PrioritySceneTarget);

            if (moveResult == MoveResult.PathGenerationFailed)
            {
                DbHelper.Log(TrinityLogLevel.Normal, LogCategory.ProfileTag, "Unable to navigate to Scene {0} - {1} Center {2} Distance {3:0}, cancelling!",
                             CurrentPriorityScene.Name, CurrentPriorityScene.SceneInfo.SNOId, PrioritySceneTarget, PrioritySceneTarget.Distance2D(myPos));
                PrioritySceneMoveToFinished();
            }
        }